Cypress: npm install --only=development crashes due to is-promise in dependency listr

Created on 1 May 2020  路  4Comments  路  Source: cypress-io/cypress

Current 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

> [email protected] 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

needs investigating installation bug

All 4 comments

I'm not able to reproduce this. Try cleaning your node_modules or running npm prune.

Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.

This is still very much happening :(

Ok, yah I actually am able to reproduce this. I feel like this didn't reproduce last time I ran it.

Love how unhelpful this thread is :/ https://github.com/nodejs/help/issues/1846

Add the below to package.json and run npm install --only=development

{
  "dependencies": {
    "@nestjs/common": "^6.8.3"
  },
  "devDependencies": {
    "cypress": "4.10.0"
  }
}

npm install --only=development

> [email protected] postinstall /Users/jennifer/Dev/cypress-transform-test/node_modules/cypress
> node index.js --exec install

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

Error: Cannot find module 'is-promise'
Require stack:
- /Users/jennifer/Dev/cypress-transform-test/node_modules/listr/lib/task.js
- /Users/jennifer/Dev/cypress-transform-test/node_modules/listr/index.js
- /Users/jennifer/Dev/cypress-transform-test/node_modules/cypress/lib/tasks/install.js
- /Users/jennifer/Dev/cypress-transform-test/node_modules/cypress/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/jennifer/Dev/cypress-transform-test/node_modules/listr/lib/task.js:2:19)
    at Module._compile (internal/modules/cjs/loader.js:1147:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
    at Module.load (internal/modules/cjs/loader.js:996:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/jennifer/Dev/cypress-transform-test/node_modules/listr/index.js:3:14)
    at Module._compile (internal/modules/cjs/loader.js:1147:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
    at Module.load (internal/modules/cjs/loader.js:996:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/jennifer/Dev/cypress-transform-test/node_modules/listr/lib/task.js',
    '/Users/jennifer/Dev/cypress-transform-test/node_modules/listr/index.js',
    '/Users/jennifer/Dev/cypress-transform-test/node_modules/cypress/lib/tasks/install.js',
    '/Users/jennifer/Dev/cypress-transform-test/node_modules/cypress/index.js'
  ]
}
npm WARN @nestjs/[email protected] requires a peer of reflect-metadata@^0.1.12 but none is installed. You must install peer dependencies yourself.
npm WARN @nrwl/[email protected] requires a peer of @nrwl/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @cypress/[email protected] requires a peer of webpack@^4.18.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@>=2 but none is installed. You must install peer dependencies yourself.
npm WARN cypress-transform-test No repository field.
npm WARN cypress-transform-test No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node index.js --exec install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jennifer/.npm/_logs/2020-07-08T07_19_41_110Z-debug.log
Was this page helpful?
0 / 5 - 0 ratings

Related issues

weskor picture weskor  路  3Comments

zbigniewkalinowski picture zbigniewkalinowski  路  3Comments

egucciar picture egucciar  路  3Comments

jennifer-shehane picture jennifer-shehane  路  3Comments

SecondFlight picture SecondFlight  路  3Comments