npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2

在本地环境或者cicd时,有node-sass依赖,在install时出现以下报错:

 1 npm ERR! In file included from ../src/binding.cpp:1:
 2 npm ERR! In file included from ../../nan/nan.h:58:
 3 npm ERR! In file included from /Users/soku/.node-gyp/16.13.1/include/node/node.h:63:
 4 npm ERR! In file included from /Users/soku/.node-gyp/16.13.1/include/node/v8.h:30:
 5 npm ERR! /Users/ssss/.node-gyp/16.13.1/include/node/v8-internal.h:492:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
 6 npm ERR!             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
 7 npm ERR!                                 ~~~~~^~~~~~~~~~~
 8 npm ERR!                                      remove_cv
 9 npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/c++/v1/type_traits:710:50: note: 'remove_cv' declared here
10 npm ERR! template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
11 npm ERR!                                                  ^
12 npm ERR! 1 error generated.
13 npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1
14 npm ERR! gyp ERR! build error
15 npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
16 npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/soku/Work/reader/node_modules/node-gyp/lib/build.js:262:23)
17 npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
18 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
19 npm ERR! gyp ERR! System Darwin 20.6.0
20 npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/soku/Work/dreader/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
21 npm ERR! gyp ERR! cwd /Users/soku/Work/reader/node_modules/node-sass
22 npm ERR! gyp ERR! node -v v16.13.1
23 npm ERR! gyp ERR! node-gyp -v v3.8.0
24 npm ERR! gyp ERR! not ok
25 npm ERR! Build failed with error code: 1

主要原因是nodejs版本与node-sass版本不对应导致,可以通过修改版本解决。

 

以下是nodejs与node-sass的支持版本:

 

posted @ 2024-05-14 09:08  keRee  阅读(151)  评论(0编辑  收藏  举报