node.js - 无法安装 node-sass npm 模块

标签 node.js ubuntu sass npm nvm

我正在尝试在我的 Ubuntu 14.04 发行版上安装 npm 模块“node-sass”。

当我运行时

node -v

我明白了

v0.10.32

但是,当尝试使用此命令安装 node-sass 和 harp 时:

sudo npm install -g harp

我收到以下错误:

child_process: customFds option is deprecated, use stdio instead.
gyp ERR! configure error 
gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
gyp ERR! stack     at install (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:66:16)
gyp ERR! stack     at Object.self.commands.(anonymous function) [as install] (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:66:37)
gyp ERR! stack     at getNodeDir (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:152:20)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:95:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:722:7)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at maybeClose (child_process.js:999:16)
gyp ERR! stack     at Socket.<anonymous> (child_process.js:1167:11)
gyp ERR! stack     at Socket.emit (events.js:107:17)
gyp ERR! stack     at Pipe.close (net.js:461:12)
gyp ERR! System Linux 3.13.0-36-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/harp/node_modules/terraform/node_modules/node-sass
gyp ERR! node -v v0.13.0-pre
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok 
Build failed
npm ERR! node-sass@0.9.3 install: `node build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@0.9.3 install script.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node build.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.13.0-36-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "harp"
npm ERR! cwd /home/colin
npm ERR! node -v v0.13.0-pre
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/colin/npm-debug.log
npm ERR! not ok code 0

请注意,该错误表明我的 Node 版本仍然是 v0.13.0-pre,即使我使用 nvm 切换到 0.10.32。

最佳答案

问题已有 3 年历史,但我最近在 osx 上尝试安装 harp 时遇到了同样的问题,但在其他地方找不到解决方案。

经过多次尝试,使用 --unsafe-perm 修饰符解决了这个问题,如下所示: sudo npm install --global --unsafe-perm harp

安装成功,一切正常,希望对您有所帮助:)

关于node.js - 无法安装 node-sass npm 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26030773/

相关文章:

ruby-on-rails - rails : Can't include scss in rails 4. 1.1。 - 类型错误:对象不支持此属性或方法

node.js - 通过 TS 使用路径映射调试 Nest App

linux - 如何为 node.js 应用程序正确设置 upstart

python - Django Apache 2 ModuleNotFoundError : No module named 'django'

node.js - 无法在 Ubuntu 12.04 上使用 CoffeeScript 安装 Node.js

css - 如何解决这个 Sass 编译错误?

css - 如何使用 SASS 或 CSS3 将 !important 放在所有 CSS 属性中?

node.js - Azure 上使用 NodeJS 的 Websocket

node.js - $and 运算符在 mongodb 中不返回任何结果?

linux - 获取linux中的显卡信息(/proc文件系统)