emulator icon indicating copy to clipboard operation
emulator copied to clipboard

local install / no admin rights / sls run fails because it tries a global install of the emulator

Open aheissenberger opened this issue 6 years ago • 2 comments

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"
  }

aheissenberger avatar Sep 29 '17 04:09 aheissenberger

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.

ericstephens avatar May 26 '18 11:05 ericstephens

I've run into this issue as well and am hoping for suggestions to work around the problem. NVM?

tpesce avatar Jun 13 '18 01:06 tpesce