node.js - 无法安装 node-sass
问题描述
我正在尝试安装 node-sass,但它不会让我这样做。我已经尝试更新 npm。
我把这个放在:
sudo npm install -g node-sass
我得到了这个(在错误之前开始一行):
gyp verb build dir attempting to create "build" dir:
/Users/matt/node_modules/node-sass/build
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir
'/Users/matt/node_modules/node-sass/build'
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/bin/node"
"/Users/matt/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "-
-verbose" "--libsass_ext=" "--libsass_cflags=" "--
libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/matt/node_modules/node-sass
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN enoent ENOENT: no such file or directory, open
'/Users/matt/package.json'
npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but
none is installed. You must install peer dependencies yourself.
npm WARN matt No description
npm WARN matt No repository field.
npm WARN matt No README data
npm WARN matt No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.9.2 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.9.2 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! /Users/matt/.npm/_logs/2018-08-02T16_18_15_228Z-
debug.log
解决方案
sudo npm install -g --unsafe-perm node-sass
这必须解决问题
推荐阅读
- php - 无法在模式窗口中显示 pdf 文件
- android - 适用于所有移动设备的 Webview 应用程序并上传到 Play 商店
- php - 致命错误:未捕获的错误:在动态变量命名空间中找不到类
- unit-testing - 如何在排除某些文件的情况下测试包?
- node.js - 在 Docker Compose 中声明时未定义 NodeJS 环境变量
- regex - rsync 转义括号和空格
- javascript - 显示和隐藏一个 div 使用 css 问题添加按钮单击时间
- python - 返回的 html 元素数量不正确
- postgresql - 在postgresql中将逗号分隔的id转换为逗号分隔的字符串
- javascript - 滚动浏览网站时更改固定 div 中的文本