Mac M1 (ARM) NPM install error handling

Time:2021-9-11

Problem: when front end engineering runs NPM install on M1 processor, an error is reported:

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<char>' [-Wrange-loop-construct]
npm ERR!         for (const auto numerator : numerators)

The reason is that node sass does not support the current environment: arm.


Solution: replace node sass with sass
Delete “dependencies”: {“node sass”: “^ 4.9.4”} in package.jason
Then execute

npm uninstall node sass
npm install sass
npm install