emulator
emulator copied to clipboard
local install / no admin rights / sls run fails because it tries a global install of the emulator
I am using "serverless" installed local with the project and would like to do this with the emulator too.
But whenever I call ../../node_modules/.bin/sls run
(https://github.com/serverless/serverless/pull/4034#issuecomment-330960579) it tries to do a global install and fails on my system as I do not have admin rights:
$ ../../node_modules/.bin/sls run
Serverless Installing Emulator
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ah/.npm/_logs/2017-09-20T19_38_14_739Z-debug.log
Error --------------------------------------------------
Command failed: npm install -g @serverless/[email protected]
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ah/.npm/_logs/2017-09-20T19_38_14_739Z-debug.log
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: darwin
Node Version: 8.5.0
Serverless Version: 1.22.0
packages.json
"devDependencies": {
"serverless": "^1.22.0",
"@serverless/emulator": "0.1.18"
}
is there a way to install the emulator once (as sudo / root), then go about testing as non-root? I'm having the same problem.
I've run into this issue as well and am hoping for suggestions to work around the problem. NVM?