Create-react-native-app: yarnpkg add --dev --exact react-native-scripts failed

Created on 14 Mar 2017  ·  9Comments  ·  Source: expo/create-react-native-app

yarn global add create-react-native-app
create-react-native-app funstuff
node 7.7.0

Creating a new React Native app in /Users/peter/Sites/crna/funstuff.

Installing packages. This might take a couple minutes.
Installing react-native-scripts...

yarn add v0.21.3
info No lockfile found.
[1/4] 🔍  Resolving packages...
warning react-native-scripts > xdl > [email protected]: use uuid module instead
warning react-native-scripts > xdl > @exponent/ngrok > [email protected]: use uuid module instead
warning react-native-scripts > xdl > auth0-js > xtend > [email protected]:
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
[1/5] ⢀ @exponent/ngrok: ngrok - downloading binary https://bin.equinox.io/c/6raCnPaTf2c/ngrok-beta-darwin-amd64.zip ...
[2/5] ⢀ dtrace-provider
[3/5] ⢀ ref:          ^
[4/5] ⢀ runas:          ^
error /Users/peter/Sites/crna/funstuff/node_modules/ref: Command failed.
Exit code: 1
Command: sh
Arguments: -c node-gyp rebuild
Directory: /Users/peter/Sites/crna/funstuff/node_modules/ref
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp info spawn /usr/bin/python
gyp info spawn args [ '/usr/local/Cellar/yarn/0.21.3/libexec/lib/node_modules/yarn/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/peter/Sites/crna/funstuff/node_modules/ref/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/Cellar/yarn/0.21.3/libexec/lib/node_modules/yarn/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/peter/.node-gyp/7.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/peter/.node-gyp/7.7.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/Cellar/yarn/0.21.3/libexec/lib/node_modules/yarn/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/peter/Sites/crna/funstuff/node_modules/ref',
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=.' ]
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/binding/src/binding.o
In file included from ../src/binding.cc:5:
/Users/peter/.node-gyp/7.7.0/include/node/node.h:44:10: fatal error: 'tracing/trace_event.h' file not found
#include "tracing/trace_event.h"
         ^
1 error generated.
make: *** [Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/yarn/0.21.3/libexec/lib/node_modules/yarn/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.4.0
gyp ERR! command "/Users/peter/.nvm/versions/node/v7.7.0/bin/node" "/usr/local/Cellar/yarn/0.21.3/libexec/lib/node_modules/yarn/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/peter/Sites/crna/funstuff/node_modules/ref
gyp ERR! node -v v7.7.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
`yarnpkg add --dev --exact react-native-scripts` failed

Most helpful comment

For those of you running Node 7.7.0, please upgrade to 7.7.2 and this will be resolved. See https://github.com/nodejs/node/issues/11628

All 9 comments

For those of you running Node 7.7.0, please upgrade to 7.7.2 and this will be resolved. See https://github.com/nodejs/node/issues/11628

Hi,

After updating my node version to 7.7.2. I'm still experiencing the same error. Not sure if it's any use but I already tried 'npm cache clean' and 'yarn cache clean'. Any idea what might be the cause would help, thanks.

yarn version: 0.21.3
node version: 7.7.2

@ganjahnavarro I'm looking into this this morning, I think that there was a behavioral change in yarn that I must have missed in my testing. I'm hoping to have a release out later today which resolves the issue.

Hey @ganjahnavarro,

Make sure you're actually using 7.7.2 right before you're running the command to make sure (sanity check).

If you've been using yarn, you might have some luck re-linking your global packages using something like this (easiest way): https://github.com/bradley-curran/fix-yarn-global-packages

I'd also recommend trying yarn cache clean. Need to look into some of the underlying issues more though.

@dikaiosune

I already tried yarn cache clean before hand. I also tried using https://github.com/bradley-curran/fix-yarn-global-packages but it doesn't fix the issue.

By the way, I tried uninstalling yarn temporarily to _force_ the creation of project to use npm instead of yarn and then it works. So it is surely a yarn issue.

Thanks a lot!

Excellent! Glad it worked for you. I need to force yarn to treat optional dependencies as OK to fail.

I am still facing this issue, is uninstalling yarn the only option?

This issue is pretty old so the root cause might be different. If you don't want to debug & diagnose it, you could try expo-cli (https://blog.expo.io/announcing-expo-dev-tools-beta-c252cbeccb36) and seeing if that works better for you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andyvanosdale picture andyvanosdale  ·  3Comments

anp picture anp  ·  3Comments

kinergy picture kinergy  ·  4Comments

Hareesh007 picture Hareesh007  ·  4Comments

FezVrasta picture FezVrasta  ·  3Comments