npm安装失败,node_modules消失

npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated [email protected]: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm ERR! code 1
npm ERR! path /Users/mefron/devel/uvamiller_local/prod/docroot/themes/custom/miller/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /usr/local/Cellar/node/16.6.1/bin/node /Users/mefron/devel/uvamiller_local/prod/docroot/themes/custom/miller/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR!   c++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DLIBSASS_VERSION="3.3.6"' -I/Users/mefron/.node-gyp/16.6.1/include/node -I/Users/mefron/.node-gyp/16.6.1/src -I/Users/mefron/.node-gyp/16.6.1/deps/openssl/config -I/Users/mefron/.node-gyp/16.6.1/deps/openssl/openssl/include -I/Users/mefron/.node-gyp/16.6.1/deps/uv/include -I/Users/mefron/.node-gyp/16.6.1/deps/zlib -I/Users/mefron/.node-gyp/16.6.1/deps/v8/include -I../src/libsass/include  -O3 -gdwarf-2 -mmacosx-version-min=10.7 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=c++11 -stdlib=libc++ -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
...
[huge dump here]
...
npm ERR! gyp ERR! System Darwin 20.6.0
npm ERR! gyp ERR! command "/usr/local/Cellar/node/16.6.1/bin/node" "/Users/mefron/devel/uvamiller_local/prod/docroot/themes/custom/miller/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Users/mefron/devel/uvamiller_local/prod/docroot/themes/custom/miller/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.6.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1

这个问题是由于项目的依赖包过于原始,并且node gyp不支持新的节点版本。使用nvm降级您的节点版本,然后使用npm install。尝试节点6.x(指的是npm版本)

先卸载node,尝试下载nvm,用工具管理node版本,然后下载10.X版本的node重新npm install

然后就搞定了,亲试有用


以下步骤

nvm 下载地址传送门 :https://gist.github.com/d2s/372b5943bce17b964a79

然后就是卸载本地已安装的node

然后nvm install 10.16.0

再nvm use 10.16.0

然后重新npm install

搞定

你可能感兴趣的:(npm安装失败,node_modules消失)