0


node-sass与node版本映射

1、背景

版本不匹配,比如在node16上面安装node-sass 4.x,那么就可能会报以下错误

npm ERR!&npm ERR!2 warnings generated.
npm ERR! In file included from ../src/binding.cpp:1:
npm ERR! In file included from ../../nan/nan.h:58:
npm ERR! In file included from /Users/chris/.node-gyp/16.13.1/include/node/node.h:63:
npm ERR! In file included from /Users/chris/.node-gyp/16.13.1/include/node/v8.h:30:
npm ERR! /Users/chris/.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'?
npm ERR!!std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);npm ERR!                                 ~~~~~^~~~~~~~~~~
npm ERR!                                      remove_cv
npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/c++/v1/type_traits:710:50: note: 'remove_cv' declared here
npm ERR! template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
npm ERR!                                                  ^
npm ERR!1 error generated.
npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/chris/Java/datax-web-ui/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""/Users/chris/Java/datax-web-ui/node_modules/node-gyp/bin/node-gyp.js""rebuild""--verbose""--libsass_ext=""--libsass_cflags=""--libsass_ldflags=""--libsass_library="npm ERR! gyp ERR! cwd /Users/chris/Java/datax-web-ui/node_modules/node-sass
npm ERR! gyp ERR!node -v v16.13.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/chris/.npm/_logs/2021-12-20T01_39_51_471Z-debug.log

项目中 node-sass 版本为4.x,本地node为14,但是服务器安装的node版本是 16,要求node-sass版本为 6.x,更换node即可

在这里插入图片描述

标签: sass npm 前端

本文转载自: https://blog.csdn.net/qq_44787816/article/details/127170602
版权归原作者 白鸽呀 所有, 如有侵权,请联系我们删除。

“node-sass与node版本映射”的评论:

还没有评论