Solve NPM errors when installing node_modules on MacOSX M1

Viewed 363

When trying to install NPM modules from a VUEJS web-app I get the following errors when running

npm i

2987 error 2 warnings generated.
2987 error In file included from ../src/binding.cpp:1:
2987 error In file included from ../../nan/nan.h:56:
2987 error In file included from /Users/farhang/Library/Caches/node-gyp/16.2.0/include/node/node.h:63:
2987 error In file included from /Users/farhang/Library/Caches/node-gyp/16.2.0/include/node/v8.h:30:
2987 error /Users/farhang/Library/Caches/node-gyp/16.2.0/include/node/v8-internal.h:452:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
2987 error             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
2987 error                                 ~~~~~^~~~~~~~~~~
2987 error                                      remove_cv
2987 error /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:776:50: note: 'remove_cv' declared here
2987 error template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
2987 error                                                  ^
2987 error 1 error generated.
2987 error make: *** [Release/obj.target/binding/src/binding.o] Error 1
2987 error gyp ERR! build error
2987 error gyp ERR! stack Error: `make` failed with exit code: 2
2987 error gyp ERR! stack     at ChildProcess.onExit (/Users/farhang/Desktop/Covidplanner_website/covid-frontend/node_modules/node-gyp/lib/build.js:194:23)
2987 error gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
2987 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
2987 error gyp ERR! System Darwin 20.3.0
2987 error gyp ERR! command "/usr/local/bin/node" "/Users/farhang/Desktop/Covidplanner_website/covid-frontend/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
2987 error gyp ERR! cwd /Users/farhang/Desktop/Covidplanner_website/covid-frontend/node_modules/node-sass
2987 error gyp ERR! node -v v16.2.0
2987 error gyp ERR! node-gyp -v v7.1.2
2987 error gyp ERR! not ok
2987 error Build failed with error code: 1
2988 verbose exit 1

I've installed Xcode command line tools. I've tried running terminal with and without rosetta. But can't seem to find what causes this problem.

0 Answers
Related