我正在尝试安装node-sass,但由于以下错误而失败。我尝试执行rebuild命令,但没有运气-sudo npm rebuild node-sass
$ npm install node-sass
...
...
...
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /home/lau/.node-gyp/10.12.0
gyp verb `which` succeeded for `make` /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/var/www/html/projects/autopoiesis/autopoiesis/node_modules/gulp-sass/node_modules/node-sass/build'
g++ '-DNODE_GYP_MODULE_NAME=binding' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/lau/.node-gyp/10.12.0/include/node -I/home/lau/.node-gyp/10.12.0/src -I/home/lau/.node-gyp/10.12.0/deps/openssl/config -I/home/lau/.node-gyp/10.12.0/deps/openssl/openssl/include -I/home/lau/.node-gyp/10.12.0/deps/uv/include -I/home/lau/.node-gyp/10.12.0/deps/zlib -I/home/lau/.node-gyp/10.12.0/deps/v8/include -I../../../../nan -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -std=c++0x -MMD -MF ./Release/.deps/Release/obj.target/binding/src/binding.o.d.raw -c -o Release/obj.target/binding/src/binding.o ../src/binding.cpp
In file included from ../src/binding.cpp:3:0:
../src/sass_context_wrapper.h:8:10: fatal error: sass/context.h: No such file or directory
#include <sass/context.h>
^~~~~~~~~~~~~~~~
compilation terminated.
binding.target.mk:116: recipe for target 'Release/obj.target/binding/src/binding.o' failed
make: *** [Release/obj.target/binding/src/binding.o] Error 1
make: Leaving directory '/var/www/html/projects/autopoiesis/autopoiesis/node_modules/gulp-sass/node_modules/node-sass/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/var/www/html/projects/autopoiesis/autopoiesis/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.15.0-36-generic
gyp ERR! command "/usr/bin/node" "/var/www/html/projects/autopoiesis/autopoiesis/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /var/www/html/projects/autopoiesis/autopoiesis/node_modules/gulp-sass/node_modules/node-sass
gyp ERR! node -v v10.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN website@0.1.0 No description
npm WARN website@0.1.0 No repository field.
npm WARN website@0.1.0 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/lau/.npm/_logs/2019-05-18T01_33_09_744Z-debug.log
任何想法为何?我该怎么办?
答案 0 :(得分:2)
最近的 Ubuntu 版本在默认存储库中提供了包 libsass-dev
(在 Ubuntu 20.04 上测试)
只需运行以下救援:
sudo apt-get install libsass-dev
答案 1 :(得分:1)
尝试使用LIBSASS_EXT="no" npm install
安装它(删除node_modules
文件夹以触发node-sass
构建,但要注意删除)-基本上,您必须检查libsass
安装。您是否在计算机上安装了libsass
?在Mac上是brew install libsass
或在Linux上。