mac M1(arm)npm install 报错处理

问题:前端工程在M1处理器上运行npm install时报错:

2 warnings generated.
npm ERR! In file included from ../src/libsass/src/to_c.cpp:3:
npm ERR! ../src/libsass/src/ast.hpp:1614:25: warning: loop variable 'numerator' creates a copy from type 'const std::__1::basic_string' [-Wrange-loop-construct]
npm ERR!         for (const auto numerator : numerators)

原因是node sass不支持当前的环境:arm。


解决办法:用sass 代替node sass
删除掉package.jeson中"dependencies": {"node-sass": "^4.9.4"}
然后执行

npm uninstall node sass
npm install sass
npm install

你可能感兴趣的:(前端npmnode.js)