apideck-libraries/postman-to-k6

Error: Cannot find module 'prettier'

ngeaney opened this issue ยท 5 comments

get the following issue when running postman-to-k6 PostmanScript.json -e PostmanGlobals.json -o k6-script.js

node:internal/modules/cjs/loader:1042
throw err;
^

Error: Cannot find module 'prettier'
Require stack:

  • /opt/homebrew/lib/node_modules/@apideck/postman-to-k6/lib/render/index.js
  • /opt/homebrew/lib/node_modules/@apideck/postman-to-k6/lib/convert/object.js
  • /opt/homebrew/lib/node_modules/@apideck/postman-to-k6/lib/convert/json.js
  • /opt/homebrew/lib/node_modules/@apideck/postman-to-k6/lib/convert/file.js
  • /opt/homebrew/lib/node_modules/@apideck/postman-to-k6/bin/postman-to-k6.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object. (/opt/homebrew/lib/node_modules/@apideck/postman-to-k6/lib/render/index.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1218:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12)
    at Module.require (node:internal/modules/cjs/loader:1105:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/opt/homebrew/lib/node_modules/@apideck/postman-to-k6/lib/render/index.js',
    '/opt/homebrew/lib/node_modules/@apideck/postman-to-k6/lib/convert/object.js',
    '/opt/homebrew/lib/node_modules/@apideck/postman-to-k6/lib/convert/json.js',
    '/opt/homebrew/lib/node_modules/@apideck/postman-to-k6/lib/convert/file.js',
    '/opt/homebrew/lib/node_modules/@apideck/postman-to-k6/bin/postman-to-k6.js'
    ]
    }

Node.js v19.3.0

Hello,

Same here, I installed Node minutes before, then ran npm install -g @apideck/postman-to-k6. All looked good.
I ran postman-to-k6 -e local.postman_environment.json -s test.postman_collection.json -o k6-script.js and got the same error.
Running with no args at all produces the same behavior.

I hope this helps.

My env :
Windows 10
NodeJS v19.5.0
NPM 9.3.1

Saw the same error with "@apideck/postman-to-k6": "^1.8.7".

For others that see this, the easy workaround is to manually install the prettier package. prettier version 2.8.3 works for me.
npm install -D prettier

install prettier seperately solves this issue

Saw the same error with "@apideck/postman-to-k6": "^1.8.7".

For others that see this, the easy workaround is to manually install the prettier package. prettier version 2.8.3 works for me. npm install -D prettier

Yes it is a workaround but not a solution.
In like a CI/CD system, you don't want to do this.
I'll try to do a PR to fix it when I have time.

Hi all,
We just released version 1.8.8 of postman-to-k6 with a fix from @BenjaminDls that will solve this issue.