Create-react-app: Creation with Yarn PnP fails on Node 11.7.0 and 11.8.0

Created on 25 Jan 2019  Β·  14Comments  Β·  Source: facebook/create-react-app

Is 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?

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:)

  1. yarn create react-app my-app --use-pnp
  2. cd my-app/
  3. yarn start
  4. 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 "[email protected]" 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 [email protected]
node-pre-gyp info using [email protected] | 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 [email protected] and [email protected] (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 [email protected]
gyp info using [email protected] | darwin | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | 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
β”œβ”€ [email protected]
β”œβ”€ [email protected]
└─ [email protected]
info All dependencies
β”œβ”€ [email protected]
β”œβ”€ [email protected]
└─ [email protected]
✨  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

  1. git clone [email protected]:yhoiseth/cra-pnp-issue.git
  2. cd cra-pnp-issue
  3. yarn
stale

Most helpful comment

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 πŸ™‚

All 14 comments

CC @arcanis πŸ™‚

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 πŸ™‚

Thanks a lot for the quick response πŸ™‚

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?

You're right. I tried with Node 10.15.0, and it works without any issues.

There's also an issue related to node-pre-gyp, but at least a different Node release should unblock you for now πŸ™‚

I didn't experience any issues with node-pre-gyp either on Node 10. Also, I should have noted that this didn't actually block me. I'm only testing the waters with Yarn PnP at the moment. Keep up the good work πŸ™‚

same with 11.8.0

not clear, what is the solution ?

I'm having same problem with Error: Cannot find module 'rxjs' using Node 11.8.0 and create-react-app --typescript

@Sharlaan downgrade to 10.15 like suggested by @arcanis.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

I don't think this issue should be closed.

@yhoiseth @arcanis This has been bothering me as it sticks with 11.10.1. When testing:

  1. yarn create react-app test doesn't trigger the problem (yarn build -> Cannot find module 'react-dev-utils/crossSpawn')
  2. yarn create react-app test --use-pnp does

May anybody confirm this on their setup?

The problem still occurs on Node 11.10.1

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

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 πŸ™‚

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dualcnhq picture dualcnhq  Β·  3Comments

alleroux picture alleroux  Β·  3Comments

oltsa picture oltsa  Β·  3Comments

jnachtigall picture jnachtigall  Β·  3Comments

JimmyLv picture JimmyLv  Β·  3Comments