node-sass與node版本映射問(wèn)題
背景
版本不匹配,比如在node16上面安裝node-sass 4.x
就可能會(huì)報(bào)以下錯(cuò)誤
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 1 npm ERR! gyp ERR! build error npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2 npm 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: 1 npm 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
項(xiàng)目中 node-sass 版本為4.x
本地node為14,但是服務(wù)器安裝的node版本是 16,要求node-sass版本為 6.x,更換node即可。

總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Nodejs對(duì)postgresql基本操作的封裝方法
今天小編就為大家分享一篇Nodejs對(duì)postgresql基本操作的封裝方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-02-02
nodejs密碼加密中生成隨機(jī)數(shù)的實(shí)例代碼
本篇文章主要介紹了nodejs密碼加密中生成隨機(jī)數(shù)的實(shí)例代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-07-07
node.js連接mongoDB數(shù)據(jù)庫(kù) 快速搭建自己的web服務(wù)
這篇文章主要為大家詳細(xì)介紹了node.js連接mongoDB數(shù)據(jù)庫(kù),如何快速搭建自己的web服務(wù),感興趣的小伙伴們可以參考一下2016-04-04
Nodejs Express4.x開(kāi)發(fā)框架隨手筆記
Express: ?web application framework for?Node.js?Express 是一個(gè)簡(jiǎn)潔、靈活的 node.js Web 應(yīng)用開(kāi)發(fā)框架, 它提供一系列強(qiáng)大的特性,幫助你創(chuàng)建各種 Web 和移動(dòng)設(shè)備應(yīng)用,本篇文章給大家介紹nodejs express4.x開(kāi)發(fā)框架隨手筆記,感興趣的朋友一起學(xué)習(xí)吧2015-11-11
node.js中的fs.truncate方法使用說(shuō)明
這篇文章主要介紹了node.js中的fs.truncate方法使用說(shuō)明,本文介紹了fs.truncate的方法說(shuō)明、語(yǔ)法、接收參數(shù)、使用實(shí)例和實(shí)現(xiàn)源碼,需要的朋友可以參考下2014-12-12
基于node.js依賴express解析post請(qǐng)求四種數(shù)據(jù)格式
本篇文章主要介紹了node.js依賴express解析post請(qǐng)求四種數(shù)據(jù)格式,主要是www-form-urlencoded,form-data,application/json,text/xml,有興趣的可以了解一下。2017-02-02

