Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module 'mkdirp' when using preact-cli with Volta #1105

Closed
green-martian-chef opened this issue Apr 1, 2020 · 0 comments · Fixed by #1418
Closed

Error: Cannot find module 'mkdirp' when using preact-cli with Volta #1105

green-martian-chef opened this issue Apr 1, 2020 · 0 comments · Fixed by #1418

Comments

@green-martian-chef
Copy link

Do you want to request a feature or report a bug?
Bug

What is the current behaviour?
I use volta to manage my stack. I tried to install preact-cli using volta but I got this error:

internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module 'mkdirp'
Require stack:
- /opt/volta/tools/image/packages/preact-cli/3.0.0-rc.10/lib/commands/create.js
- /opt/volta/tools/image/packages/preact-cli/3.0.0-rc.10/lib/commands/index.js
- /opt/volta/tools/image/packages/preact-cli/3.0.0-rc.10/lib/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/opt/volta/tools/image/packages/preact-cli/3.0.0-rc.10/lib/commands/create.js:6:16)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/opt/volta/tools/image/packages/preact-cli/3.0.0-rc.10/lib/commands/index.js:2:18)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/opt/volta/tools/image/packages/preact-cli/3.0.0-rc.10/lib/commands/create.js',
    '/opt/volta/tools/image/packages/preact-cli/3.0.0-rc.10/lib/commands/index.js',
    '/opt/volta/tools/image/packages/preact-cli/3.0.0-rc.10/lib/index.js'
  ]
}

If the current behaviour is a bug, please provide the steps to reproduce.

  • Install volta: curl https://get.volta.sh | bash
  • Install preact-cli using volta: volta install preact-cli@rc
  • Use preact command: preact -h

What is the expected behaviour?
No error when running

If this is a feature request, what is motivation or use case for changing the behaviour?

Please mention other relevant information.
This bug happens because preact-cli lists mkdirp as a dev-dependency but actually needs mkdirp to run in production and volta only install package dependencies, not dev-dependencies. Explicit list mkdirp as dependency fix the bug.

Please paste the results of preact info here.
Environment Info:
System:
OS: Linux 5.3 elementary OS 5.1.2 Hera
CPU: (6) x64 AMD FX(tm)-6300 Six-Core Processor
Binaries:
Node: 12.16.1 - /opt/volta/tools/image/node/12.16.1/6.13.4/bin/node
Yarn: 1.22.4 - /opt/volta/tools/image/yarn/1.22.4/bin/yarn
npm: 6.13.4 - /opt/volta/tools/image/node/12.16.1/6.13.4/bin/npm
Browsers:
Firefox: 74.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant