Creation with Yarn PnP fails on Node 11.7.0 and 11.8.0
See original GitHub issueIs this a bug report?
Yes.
Did you try recovering your dependencies?
Yes. I also deleted .pnp
and .pnp.js
and tried running yarn
again.
➜ my-app git:(master) ✗ yarn --version
1.13.0
Which terms did you search for in User Guide?
- “pnp”
- I also checked https://yarnpkg.com/en/docs/pnp/troubleshooting
Environment
Environment Info:
System:
OS: macOS 10.14.2
CPU: x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
Binaries:
Node: 11.7.0 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.5.0 - /usr/local/bin/npm
Browsers:
Chrome: 71.0.3578.98
Safari: 12.0.2
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found
I use Fish shell 3.0.0.
Steps to Reproduce
(Write your steps here:)
yarn create react-app my-app --use-pnp
cd my-app/
yarn start
env NODE_OPTIONS="--require .pnp.js" yarn
(just for troubleshooting, found the idea here)
Expected Behavior
No errors, able to start app.
Actual Behavior
Step 1 resulted in
yarn create v1.13.0
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
success Installed "create-react-app@2.1.3" with binaries:
- create-react-app
[################################################################] 64/64
Creating a new React app in /Users/yngve/Repositories/playground/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.13.0
[1/5] 🔍 Resolving packages...
[2/5] 🚚 Fetching packages...
[3/5] 🔗 Linking dependencies...
[5/5] 🔨 Building fresh packages...
warning Error running install script for optional dependency: "/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents: Command failed.
Exit code: 1
Command: node install
Arguments:
Directory: /Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.10.0
node-pre-gyp info using node@11.7.0 | darwin | x64
node-pre-gyp info check checked for \"/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node\" (not found)
node-pre-gyp http GET https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz
node-pre-gyp http 404 https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz
node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.4 and node@11.7.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http 404 status code downloading tarball https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@11.7.0 | darwin | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@11.7.0 | darwin | x64
gyp info spawn /usr/bin/python
gyp info spawn args [ '/usr/local/Cellar/node/11.7.0/libexec/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/Cellar/node/11.7.0/libexec/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/yngve/.node-gyp/11.7.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/yngve/.node-gyp/11.7.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/Cellar/node/11.7.0/libexec/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/yngve/.node-gyp/11.7.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
internal/modules/cjs/loader.js:605
throw err;
^
Error: Cannot find module 'nan'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:20:18)
at [eval]:1:1
at Script.runInThisContext (vm.js:123:20)
at Object.runInThisContext (vm.js:312:38)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at evalScript (internal/process/execution.js:56:25)
gyp: Call to 'node -e \"require('nan')\"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/Cellar/node/11.7.0/libexec/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:188:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command \"/usr/local/Cellar/node/11.7.0/bin/node\" \"/usr/local/Cellar/node/11.7.0/libexec/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"configure\" \"--fallback-to-build\" \"--module=/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node\" \"--module_name=fse\" \"--module_path=/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64\" \"--napi_version=3\" \"--node_abi_napi=napi\" \"--python=/usr/bin/python\"
gyp ERR! cwd /Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents
gyp ERR! node -v v11.7.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp configure --fallback-to-build --module=/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=3 --node_abi_napi=napi --python=/usr/bin/python' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:188:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command \"/usr/local/Cellar/node/11.7.0/bin/node\" \"/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp\" \"install\" \"--fallback-to-build\"
node-pre-gyp ERR! cwd /Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents
node-pre-gyp ERR! node -v v11.7.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.0
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp configure --fallback-to-build --module=/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/yngve/Repositories/playground/my-app/.pnp/unplugged/npm-fsevents-1.2.4-f41dcb1af2582af3692da36fc55cbd8e1041c426/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=3 --node_abi_napi=napi --python=/usr/bin/python' (1)"
info This module is OPTIONAL, you can safely ignore this error
success Saved lockfile.
success Saved 3 new dependencies.
info Direct dependencies
├─ react-dom@16.7.0
├─ react-scripts@2.1.3
└─ react@16.7.0
info All dependencies
├─ react-dom@16.7.0
├─ react-scripts@2.1.3
└─ react@16.7.0
✨ Done in 5.45s.
Initialized a git repository.
Success! Created my-app at /Users/yngve/Repositories/playground/my-app
Inside that directory, you can run several commands:
yarn start
Starts the development server.
yarn build
Bundles the app into static files for production.
yarn test
Starts the test runner.
yarn eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd my-app
yarn start
Happy hacking!
✨ Done in 8.33s.
Step 3 resulted in
yarn run v1.13.0
$ react-scripts start
internal/modules/cjs/loader.js:605
throw err;
^
Error: Cannot find module 'react-dev-utils/crossSpawn'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Users/yngve/Library/Caches/Yarn/v4/npm-react-scripts-2.1.3-6e49be279f4039fb9f330d2b3529b933b8e90945/node_modules/react-scripts/bin/react-scripts.js:18:15)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Step 4 resulted in
internal/modules/cjs/loader.js:605
throw err;
^
Error: Cannot find module '.pnp.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:657:17)
at Module._preloadModules (internal/modules/cjs/loader.js:842:12)
at prepareUserCodeExecution (internal/bootstrap/node.js:456:5)
at startMainThreadExecution (internal/bootstrap/node.js:435:3)
Reproducible Demo
git clone git@github.com:yhoiseth/cra-pnp-issue.git
cd cra-pnp-issue
yarn
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Troubleshooting | Yarn
This error simply means that the specified package is requiring something without explicitly declaring it in its dependencies. Since this behavior is unsafe ......
Read more >Next.js with Yarn pnp in a mono repo keep failing when trying ...
It seems like the main problem here is the build tool, because when I run the Next.js server itself ( yarn dev )...
Read more >WTF is Yarn Plug'n'Play (PnP)? - Egghead.io
[0:30] Yarn tries to solve these issues by creating a .pnp.js file. This file is generated instead of Node modules. If I head...
Read more >Package - dependency-cruiser
npm install --save-dev dependency-cruiser (with yarn or pnpm use their equivalent to install ... To create a graph of the dependencies in your...
Read more >Support ESLint and TypeScript with Yarn PnP and Node.js 10.x
Open src/Layout.tsx. Actual: two errors are reported (see the screenshot): (a) ESLint error: ESLint: Initialization error (ESLint) ...
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 Free
Top 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
Hey! I’ve just tried the steps outlined in the OP with the current Yarn v2 trunk, and it worked perfectly. The build won’t reach stable until the v2 as a whole does, but I wanted to let you know that the bug got taken care of 🙂
It seems like this is related to fsevents not having prebuilt binaries for Node v11.7.0. Can you try with a different Node release?
There’s also an issue related to
node-pre-gyp
, but at least a different Node release should unblock you for now 🙂