npm install --only=development crashes due to is-promise in dependency listr
See original GitHub issueCurrent behavior:
When I try to execute npm install --only=development
command (for multi-stage build) installation crashes due to lack of runtime dependency minimist
in cypress’s postinstall stage.
It doesn’t happen when it is installed alone, but I found some combinations of libraries that bring this bug to life. In this case it crashes with @nestjs/common
.
stacktrace
> cypress@4.5.0 postinstall /node_modules/cypress
> node index.js --exec install
internal/modules/cjs/loader.js:960
throw err;
^
Error: Cannot find module 'is-promise'
Require stack:
- /node_modules/listr/lib/task.js
- /node_modules/listr/index.js
- /node_modules/cypress/lib/tasks/install.js
- /node_modules/cypress/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/node_modules/listr/lib/task.js:2:19)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/node_modules/listr/index.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:1133:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/node_modules/listr/lib/task.js',
'/node_modules/listr/index.js',
'/node_modules/cypress/lib/tasks/install.js',
'/node_modules/cypress/index.js'
]
}
Desired behavior:
Installing cypress with npm install --only=development
should not crash install build.
Test code to reproduce
Dockerfile
FROM node:12.13-stretch AS development
WORKDIR /usr/src/app
COPY package.json ./
RUN npm install --only=development
package.json
{
"dependencies": {
"@nestjs/common": "^6.8.3"
},
"devDependencies": {
"cypress": "^4.1.0",
"@nrwl/cypress": "9.2.3"
}
}
Versions
Cypress: 4.5.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:13 (4 by maintainers)
Top Results From Across the Web
npm install should recursively check/install dependencies #1341
After that I just had to temporarily move the dependencies from the node_modules directory and reinstall, then move them back and it worked...
Read more >npm install won't install devDependencies - Stack Overflow
If I run npm install --dev devDependencies are installed. I don't understand why npm install doesn't install devDependencies too, but installs only dependencies...
Read more >How to clean up node modules? - Mario Kandut
Manually remove and reinstall. You could remove your node_modules/ folder and then reinstall the dependencies from package.json. Remove all your ...
Read more >Adding dependencies to a package.json file - npm Docs
To add dependencies and devDependencies to a package.json file from the command line, you can install them in the root directory of your...
Read more >Node.js 15 Is Out! What Does It Mean for You? - Maxim Orlov
(node:1309) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am also getting a similar error:
package.json
Output of
npm install --only=development
Cypress@9.0.0 I got similar issue, but with in some dependency (Cannot find module ‘./promise’) The issue is that in folder ‘\node_modules\bluebird\js\release’ there was only 5-7 files, and no ‘promise.js’. And even deleting and ‘npm installing’ not fixed issue. But, I found out that root cause actually is long path of project, and then I moved it to drive root (ex. C:/projects/my-proj), and ran ‘npm install’ - everything installed correctly and works perfectly. Maybe this will help somebody.