[英]node-sass Issue on my angular project npm install (Mac OS)
I try to install node_modules for my angular project an I get issue for node-sass I use mac os, node js version -> v16.13.2, node-sass version in project ->^4.14.1 In this image1 and image2 is package.json The error that I get is:我尝试为我的 angular 项目安装 node_modules 我遇到 node-sass 的问题我使用 mac os,node js 版本 -> v16.13.2,项目中的 node-sass 版本 ->^4.14.1 在这个image1和image2是 ZEFE90A8E604A7C840E8Z8D03A67F6B7D .json 我得到的错误是:
npm ERR! 1 warning and 1 error generated.
npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (../node_modules/node-gyp/lib/build.js:262:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.6.0
npm ERR! gyp ERR! command "/usr/local/bin/node" ".../node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd .../node_modules/node-sass
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1
npm ERR! A complete log of this run can be found in:
npm ERR! .../.npm/_logs/2022-01-25T10_04_49_137Z-debug-0.log
I tied this commands npm install -g node-sass, npm uninstall -g node-sass The same I tried to install latest version of node-sass我绑定了这个命令 npm install -g node-sass, npm uninstall -g node-sass 同样我试图安装最新版本的 node-sass
You might want to run npm upgrade
to have npm check for outdated version of your dependencies.您可能希望运行npm upgrade
以让 npm 检查您的依赖项的过时版本。
Because for node 16 you need node-sass in version 6.0+因为对于节点 16,您需要 6.0+ 版本中的 node-sass
Just remove node-sass from your package.json... that solved the problem for me只需从您的 package.json 中删除 node-sass ... 即可解决我的问题
Try doing so, it worked from.尝试这样做,它的工作原理。 You need to remove it from package.json
with one the blocks below.您需要使用以下块之一将其从package.json
中删除。
If you are using npm
and that node-sass
is in your dependencies
:如果您使用的是npm
并且node-sass
在您的dependencies
项中:
npm uninstall node-sass --save
npm install node-sass --save
If you are using npm
and that node-sass
is in your devDependencies
:如果您使用的是npm
并且node-sass
在您的devDependencies
中:
npm uninstall node-sass --save-dev
npm install node-sass --save-dev
If you are using yarn
and that node-sass
is in your dependencies
:如果您使用的是yarn
并且node-sass
在您的dependencies
项中:
yarn remove node-sass --save
yarn add node-sass --save
If you are using yarn
and that node-sass
is in your devDependencies
:如果您使用的是yarn
并且node-sass
在您的devDependencies
中:
yarn remove node-sass --save-dev
yarn add node-sass --save-dev
I found a solution to this problem.我找到了解决这个问题的方法。 Simply to downgrade node version and it works只需降级节点版本即可
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.