jest: Yarn hangs when installing jest@22.0.x

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

What is the current behavior? Yarn hangs on yarn add -D jest@22.0.4.
Works fine with v21.2.1.
I deleted node_modules and yarn.lock and ran yarn cache clean just to make sure.

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

$ yarn add -D jest@22.0.0
yarn add v1.3.2
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
⠁
⠁
⠁
[1/1] ⡀ weak
[-/1] ⡀ waiting...
[1/1] ⠁ weak
[1/1] ⡀ weak
[1/1] ⠈ weak
[1/1] ⠁ weak
[-/1] ⠁ waiting...
[-/1] ⠁ waiting...
[-/1] ⠁ waiting...
[-/4] ⠄ waiting...
[-/4] ⠄ waiting...
[3/4] ⠄ weak
[-/4] ⠄ waiting...
[-/4] ⠄ waiting...

With --verbose:

...
verbose 16.456 Removing extraneous file "/Users/alex/.config/yarn/global/node_modules/tabtab/node_modules/.bin".
verbose 16.456 Removing extraneous file "/Users/alex/.config/yarn/global/node_modules/tar-pack/node_modules/.bin".
verbose 16.457 Removing extraneous file "/Users/alex/.config/yarn/global/node_modules/yarn-completions/node_modules".
verbose 16.457 Removing extraneous file "/Users/alex/.config/yarn/global/node_modules/yarn/node_modules/.bin".
verbose 16.458 Removing extraneous file "/Users/alex/.config/yarn/global/node_modules/yarn-completions/node_modules/.bin".
[-/5] ⠄ waiting...
[-/5] ⠄ waiting...
[-/5] ⡀ waiting...
[-/5] ⡀ waiting...
[-/5] ⡀ waiting...
[4/5] ⡀ weak
[4/4] 📃  Building fresh packages...
[1/4] ⠄ spawn-sync
[-/5] ⠁ waiting...
[-/5] ⠁ waiting...
[3/4] ⠠ weak
[-/4] ⠠ waiting...
verbose 17.204 Sun, 24 Dec 2017 14:31:40 GMT tabtab:installer Installing completion script to bashrc directory
Sun, 24 Dec 2017 14:31:40 GMT tabtab:installer Installing completion script to /Users/alex/.bashrc directory
[-/5] ⡀ waiting...
[-/5] ⡀ waiting...
[3/4] ⠁ weak
[-/4] ⠁ waiting...
verbose 18.416 node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.39
node-pre-gyp info using node@9.3.0 | darwin | x64
node-pre-gyp info check checked for "/Users/alex/.config/yarn/global/node_modules/fsevents/lib/binding/Release/node-v59-darwin-x64/fse.node" (not found)
node-pre-gyp http GET https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.1.3/fse-v1.1.3-node-v59-darwin-x64.tar.gz
node-pre-gyp http 200 https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.1.3/fse-v1.1.3-node-v59-darwin-x64.tar.gz
node-pre-gyp info install unpacking fse.node
[-/5] ⠄ waiting...
[-/4] ⠈ waiting...
[3/4] ⠈ weak
[-/4] ⠈ waiting...
[-/4] ⠈ waiting...

What is the expected behavior? Should not hang

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

Node v9.3.0 Yarn 1.3.2 Mac OS X 10.12.6

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 35 (13 by maintainers)

Most upvoted comments

Yeah, I think we might remove the dependency to jest-leak-detector (either converting it to peer, or removing it completely), and hard crashing whenever leak detection needs to be used but jest-leak-detector is not on your node_modules folder.

@mjesun To be clear, since I first reported an issue mine now exits with error code zero, but I don’t know what fixed it.

As a slight aside, I’m personally not a fan of a popular library like jest having an install experience that looks scary even when it works, I don’t know if that’s something you guys care about or not. My working install looks like this. image If I saw this and didn’t know what was going on, I’d be concerned and spend some time investigating despite the eventual skipping of the failure.

Oh, that’s really interesting! You just found a bug in either lerna or yarn.

$ y info jest-leak-detector dependencies
yarn info v1.3.2
{ 'pretty-format': '^22.0.3',
  weak: '^1.0.1' }
✨  Done in 0.20s.

Experienced this issue as well.

Node v9.3.0 Yarn 1.3.2 MacOS High Sierra 10.13.1

@SamPruden Sure thing - here’s console output while trying to install with yarn:

$ yarn
yarn install v1.3.2
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
[1/4] ⠄ uglifyjs-webpack-plugin
[2/4] ⠄ fsevents
[-/4] ⡀ waiting...
[-/4] ⡀ waiting...
[-/4] ⡀ waiting...
[-/4] ⡀ waiting...
[-/4] ⡀ waiting...
[-/4] ⡀ waiting...
[-/4] ⡀ waiting...
[-/4] ⡀ waiting...
[4/4] ⡀ weak
[4/4] 📃  Building fresh packages...
[-/2] ⠁ waiting...
[2/2] ⠁ weak
[-/2] ⠁ waiting...
[-/2] ⠁ waiting...
[-/2] ⠁ waiting...

Here’s console output when installing with npm:

$ npm install

> fsevents@1.1.3 install [Project directory]/node_modules/fsevents
> node install

[fsevents] Success: "[Project directory]/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> weak@1.0.1 install [Project directory]/node_modules/weak
> node-gyp rebuild

  CXX(target) Release/obj.target/weakref/src/weakref.o
  SOLINK_MODULE(target) Release/weakref.node

> node-sass@4.7.2 install [Project directory]/node_modules/node-sass
> node scripts/install.js

Cached binary found at [User directory]/.npm/node-sass/4.7.2/darwin-x64-57_binding.node

> uglifyjs-webpack-plugin@0.4.6 postinstall [Project directory]/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js


> node-sass@4.7.2 postinstall [Project directory]/node_modules/node-sass
> node scripts/build.js

Binary found at [Project directory]/node_modules/node-sass/vendor/darwin-x64-57/binding.node
Testing binary
Binary is fine
added 1572 packages in 41.099s

Here’s my package.json file:

{
  "name": "project",
  "private": true,
  "dependencies": {
    "autoprefixer": "^7.1.6",
    "babel-core": "^6.26.0",
    "babel-plugin-syntax-dynamic-import": "^6.18.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-plugin-transform-decorators-legacy": "1.3.4",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-1": "^6.24.1",
    "babel-preset-stage-2": "^6.24.1",
    "babelify": "^8.0.0",
    "bootstrap": "^3.3.7",
    "browserify": "^14.5.0",
    "coffee-loader": "^0.9.0",
    "coffeescript": "^2.1.0",
    "compression-webpack-plugin": "^1.0.1",
    "cropperjs": "^1.1.3",
    "cross-fetch": "^1.1.1",
    "css-loader": "^0.28.7",
    "dotenv": "^4.0.0",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^1.1.5",
    "glob": "^7.1.2",
    "ip": "^1.1.5",
    "jquery": "^3.2.1",
    "js-yaml": "^3.10.0",
    "marked": "^0.3.6",
    "moment": "^2.19.3",
    "node-sass": "^4.7.2",
    "path-complete-extname": "^0.1.0",
    "postcss-loader": "^2.0.8",
    "postcss-smart-import": "^0.7.5",
    "precss": "^2.0.0",
    "prop-types": "^15.6.0",
    "pusher-js": "^4.2.1",
    "rails-erb-loader": "^5.2.1",
    "react": "^16.1.1",
    "react-dnd": "^2.5.4",
    "react-dnd-html5-backend": "^2.5.4",
    "react-dom": "^16.1.1",
    "react-redux": "^5.0.6",
    "redux": "^3.7.2",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.2.0",
    "resolve-url-loader": "^2.2.0",
    "sass-loader": "^6.0.6",
    "style-loader": "^0.19.0",
    "swiper": "3.4.2",
    "underscore": "^1.8.3",
    "uppy": "^0.21.0",
    "webpack": "^3.8.1",
    "webpack-manifest-plugin": "^1.3.2",
    "webpack-merge": "^4.1.1"
  },
  "devDependencies": {
    "babel-loader": "^7.1.2",
    "browserify-incremental": "^3.1.1",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^22.0.4",
    "jest-cli": "^22.0.4",
    "jquery-mockjax": "^2.2.2",
    "react-test-renderer": "^16.2.0",
    "redux-mock-store": "^1.4.0",
    "uglifyjs-webpack-plugin": "^1.1.1",
    "webpack-dev-server": "^2.9.4"
  },
  "scripts": {
    "test": "jest",
    "test:watch": "npm test -- --watch"
  },
  "jest": {
    "testPathIgnorePatterns": [
      "/node_modules/",
      "/config/",
      "/vendor/"
    ],
    "moduleNameMapper": {
      "^.+\\.(css|less|scss)$": "identity-obj-proxy"
    }
  }
}

@jaylandro Oh sorry, I just realized that people with npm is also experiencing a non-zero exit code. Being listed as optional, the compile phase should crash and the install should continue normally, skipping the dependency. I’m not sure what’s going on 😞

npm i w/ jest 22.0.4 throw this error log and fails

> weak@1.0.1 install /Users/me/project/node_modules/weak
> node-gyp rebuild

  CXX(target) Release/obj.target/weakref/src/weakref.o
clang: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX' [-Wincompatible-sysroot]
  SOLINK_MODULE(target) Release/weakref.node
clang: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX' [-Wincompatible-sysroot]
ld: building for OSX, but linking against dylib built for iOS (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.2.sdk/usr/lib/libc++.tbd). file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.2.sdk/usr/lib/libc++.tbd' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/weakref.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 17.3.0
gyp ERR! command "/usr/local/Cellar/node/8.2.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/me/project/node_modules/weak
gyp ERR! node -v v8.2.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN react-native@0.51.0 requires a peer of react@16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-calendar-picker@5.9.0 requires a peer of babel-preset-expo@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-maps@0.19.0 requires a peer of react@16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: weak@1.0.1 (node_modules/weak):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: weak@1.0.1 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1