sunmingtao / sample-code

3 stars 4 forks source link

npm install fails on webpack tutorial: gyp ERR! stack Error: `gyp` failed with exit code: 1 #230

Closed sunmingtao closed 3 years ago

sunmingtao commented 3 years ago
git clone https://github.com/vp-online-courses/webpack-tutorial.git
cd webpack-tutorial/
npm install
Click to see the detailed error ``` gyp: No Xcode or CLT version detected! gyp ERR! configure error gyp ERR! stack Error: `gyp` failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/Users/mingtao/workspace/webpack-tutorial/node_modules/node-gyp/lib/configure.js:345:16) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) gyp ERR! System Darwin 19.6.0 gyp ERR! command "/usr/local/bin/node" "/Users/mingtao/workspace/webpack-tutorial/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd /Users/mingtao/workspace/webpack-tutorial/node_modules/node-sass gyp ERR! node -v v14.15.1 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok Build failed with error code: 1 npm WARN tutorial@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/chokidar/node_modules/fsevents): npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 install: `node install` npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.12.0 postinstall: `node scripts/build.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass@4.12.0 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/mingtao/.npm/_logs/2020-12-04T19_24_26_392Z-debug.log ```
sunmingtao commented 3 years ago

Download x-code command line tool from https://developer.apple.com/download/more/ (require apple ID login)

image

Verify installation is successful

curl -sL https://github.com/nodejs/node-gyp/raw/master/macOS_Catalina_acid_test.sh | bash

Run npm install again

https://harsh-patel.medium.com/node-gyp-error-gyp-failed-with-exit-code-1-macos-npm-5aeaf75996d4