我正在尝试在create react应用程序中安装node-sass。我尝试跑步:
-std=c++11 -O2 -lm
然后出现以下错误:
sudo npm install node-sass --save
此后是安装后操作:
Unable to save binary /Users/username/Desktop/code/advocado/node_modules/node-sass/vendor/darwin-x64-57 : { Error: EACCES: permission denied, mkdir '/Users/username/Desktop/code/advocado/node_modules/node-sass/vendor'
at Object.fs.mkdirSync (fs.js:885:18)
at sync (/Users/username/Desktop/code/advocado/node_modules/mkdirp/index.js:71:13)
at Function.sync (/Users/username/Desktop/code/advocado/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/Users/username/Desktop/code/advocado/node_modules/node-sass/scripts/install.js:114:11)
at Object.<anonymous> (/Users/username/Desktop/code/advocado/node_modules/node-sass/scripts/install.js:157:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/Users/username/Desktop/code/advocado/node_modules/node-sass/vendor' }
这会运行更多代码,但是为了简洁起见,我没有将其包括在内,因为错误可能与“错误:EACCES:权限被拒绝”
这里被拒绝的权限是什么,我该如何批准?
编辑:
当我尝试运行相同的命令(即不使用node-sass@4.9.3 postinstall /Users/username/Desktop/code/advocado/node_modules/node-sass
时):
sudo
我收到以下警告:
npm install node-sass --save
答案 0 :(得分:0)
授予编辑此目录的权限
sudo chown -R $(whoami) ~/.npm