版权声明:本文为 testcs_dn(微wx笑) 原创文章,非商用自由转载-保持署名-注明出处,谢谢。 https://blog.csdn.net/testcs_dn/article/details/79729884
aws lambda 安装 SAM Local 遇到错误:
> aws-sam-local@0.2.8 postinstall /usr/local/lib/node_modules/aws-sam-local
> go-npm install
/usr/local/lib/node_modules/aws-sam-local/node_modules/mkdirp/index.js:90
throw err0;
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/aws-sam-local/bin'
at Object.fs.mkdirSync (fs.js:885:18)
at Function.sync (/usr/local/lib/node_modules/aws-sam-local/node_modules/mkdirp/index.js:71:13)
at Object.install (/usr/local/lib/node_modules/aws-sam-local/node_modules/go-npm/bin/index.js:161:12)
at Object.<anonymous> (/usr/local/lib/node_modules/aws-sam-local/node_modules/go-npm/bin/index.js:212:17)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! aws-sam-local@0.2.8 postinstall: `go-npm install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aws-sam-local@0.2.8 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/xxx/.npm/_logs/2018-03-28T08_17_57_066Z-debug.log
解决方法:
添加参数:--unsafe-perm
完整命令:
sudo npm install -g aws-sam-local --unsafe-perm
--unsafe-perm 参数说明:
- unsafe-perm: 如果设置为true,则禁止UID/GID互相切换,当运行package scripts