Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Fetching Data with the Fetch API

Problems with npm install after loading project files.

this has been an ongoing occurrence with EVERY project in the REACT series. I am finally asking the question.

What is going on? Here is my terminal output when executing npm install for this project. I have gotten similar out put for EVERY project in the series.

Dougs-MacBook-Pro:gifsearch doug5solas$ npm install
npm WARN deprecated browserslist@1.4.0: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.

> fsevents@1.0.14 install /Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents
> node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ '/usr/local/bin/node',
node-pre-gyp verb cli   '/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli   'install',
node-pre-gyp verb cli   '--fallback-to-build' ]
node-pre-gyp info using node-pre-gyp@0.6.29
node-pre-gyp info using node@10.13.0 | darwin | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for "/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" (not found)
node-pre-gyp http GET https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v64-darwin-x64.tar.gz
node-pre-gyp http 404 https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v64-darwin-x64.tar.gz
node-pre-gyp ERR! Tried to download: https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v64-darwin-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for fsevents@1.0.14 and node@10.13.0 (node-v64 ABI) (falling back to source compile with node-gyp) 
node-pre-gyp http Pre-built binary not available for your system, looked for https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v64-darwin-x64.tar.gz 
node-pre-gyp verb command build [ 'rebuild' ]
node-pre-gyp ERR! Tried to download: https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v64-darwin-x64.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for fsevents@1.0.14 and node@10.13.0 (node-v64 ABI) (falling back to source compile with node-gyp) 
node-pre-gyp http Connection closed while downloading tarball file 
node-pre-gyp verb command build [ 'rebuild' ]
  SOLINK_MODULE(target) Release/.node
  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from In file included from ../fsevents.cc../fsevents.cc::8585:
:
../src/methods.cc:14:12: ../src/methods.cc:warning14: :12: warning: 'Call''Call'  isis  deprecateddeprecated  [-Wdeprecated-declarations][-Wdeprecated-declarations]

  handler->Call(3, argv);
           ^
  handler->Call(3, argv);
           ^
../../nan/nan.h:1673:3: ../../nan/nan.h:note1673: :3:'Call'  has notebeen:  explicitly'Call'  markedhas  deprecatedbeen  hereexplicitly 
marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:103:40:../../nan/nan.h :103:note40: : expanded fromnote : macro expanded'NAN_DEPRECATED' from
 macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
1 warning generated.
1 warning generated.
rm: ./Release/.deps/Release/obj.target/fse/fsevents.o.d.raw: No such file or directory
make: *** [Release/obj.target/fse/fsevents.o] Error 1
gyp  SOLINK_MODULE(target) Release/fse.node
 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:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64"
gyp ERR! cwd /Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents
gyp ERR! node -v v10.13.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 '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node --module_name=fse --module_path=/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents
node-pre-gyp ERR! node -v v10.13.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.29
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node --module_name=fse --module_path=/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64' (1)
  COPY /Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node
  TOUCH Release/obj.target/action_after_build.stampe async@0.2.10~install: async@0.2.10
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.0.14 (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.0.14 install: `node-pre-gyp install --fallback-to-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 984 packages from 702 contributors and audited 8781 packages in 30.332s
found 41 vulnerabilities (5 low, 29 moderate, 6 high, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
Dougs-MacBook-Pro:gifsearch doug5solas$ npm audit fix --force
npm WARN using --force I sure hope you know what you are doing.

> fsevents@1.2.7 install /Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/chokidar/node_modules/fsevents
> node install

node-pre-gyp WARN Using request for node-pre-gyp https download 
[fsevents] Success: "/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote

> fsevents@1.2.4 install /Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents
> node install

[fsevents] Success: "/Users/doug5solas/training/treehouse/courses/fsjsCourses/React/gifsearch/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
npm WARN ts-pnp@1.0.0 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.

+ react-scripts@2.1.5
added 1237 packages from 461 contributors, removed 230 packages, updated 216 packages and moved 7 packages in 39.301s
fixed 41 of 41 vulnerabilities in 8781 scanned packages
  1 package update for 41 vulns involved breaking changes
  (installed due to `--force` option)
Dougs-MacBook-Pro:gifsearch doug5solas$ npm i ts-pnp
npm WARN ts-pnp@1.0.0 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.

+ ts-pnp@1.0.0
updated 1 package and audited 36388 packages in 11.201s
found 0 vulnerabilities

Dougs-MacBook-Pro:gifsearch doug5solas$ 

As you can probably tell I have been solving the problem by keying in

npm audit fix --force

I have learned that the --force option makes sure everything gets "fixed" rather than merely most things. And, as you can see, I am manually loading any dependencies that do not get loaded by npm install.

I haven't run into any problems doing this, but it is a work around. And, I don't really have a real grip on what is happening by doing the work around.

Does anyone have any idea why this is an ongoing problem and how I can perform a real fix?

4 Answers

So, as far as I can tell this error doesn't actually prevent create-react-app from being usable, but in the interest of us both understanding more I did a quick search and found this: https://github.com/facebook/create-react-app/issues/3588

Seems that depending on the version of Node you are using there may be precompiled dependencies missing. I initially saw similar errors to you installing this project, but then switched to Node version 8.15.0 as suggested in a comment from the linked issue. Using Node 8 resulted in fewer errors in the logs, but ultimately these "errors" for node-gyp seem like they can be safely ignored.

I think this is probably the correct answer. I am on Node 10.13.0, so it is likely the version discrepancy incurred because of the lag time from the course production to the time when I take it. I think my real question may have been. What is my exposure when I do the:

npm audit fix --force

because that seems to make it all go away, but at what price?

TL;DR: npm audit fix --force can fix security vulnerabilities but can also break your code by install incompatible versions of dependencies. Don't use it unless you know why you need it :P

I don't really have experience with using npm audit, but it appears to be a tool for identifying security vulnerabilities in dependencies. Take a look at this blog post from npm for more details.

If you run npm audit without the fix argument you will see a list potentially vulnerable dependencies. The node-gyp dependency is logging errors/warnings while being installed, but these warnings are not because of security vulnerabilities with the version of node-gyp, so npm audit is not relevant to node-gyp in this case.

The docs for npm audit say that npm audit fix --force could cause vulnerable dependencies to be installed with versions that do not match what is defined in the package.json file. This could introduce a breaking change by installing an incompatible version of the dependency that doesn't have the vulnerabilities that npm audit detected. I think manually updating vulnerable dependencies is the way npm audit is intended to be used.

For a learning project like this you don't need to be concerned with vulnerable dependencies unless you plan to build an application that needs to run in a production environment. It also doesn't fix anything related to the node-gyp installation. And finally, there is a risk of it installing an incompatible version of a dependency and breaking the code. With all that in mind, npm audit fix --force isn't something you should probably be using in this situation.

Kevin Gates
Kevin Gates
15,052 Points

Have you tried updating your npm modules and dependencies?

That's where I get the errors, performing the npm install, which loads the npm modules specified in the package.json. So, I guess I am not understanding your question.

I was curious and tried with yarn. The same kind of errors installing node-gyp occurred, but the output was styled a little differently.

Erik:

Thanks for the input. I will be more judicious in using npm audit fix.