Unable to install serverless

for some reason ( not sure what happened) but I am unable to install the serverless framework. This is what I got

npm WARN deprecated superagent@3.8.3: Please note that v5.0.1+ of superagent removes User-Agent header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a User-Agent header).  This notice will go away with v5.0.2+ once it is released.
/usr/local/bin/serverless -> /usr/local/lib/node_modules/serverless/bin/serverless.js
/usr/local/bin/slss -> /usr/local/lib/node_modules/serverless/bin/serverless.js
/usr/local/bin/sls -> /usr/local/lib/node_modules/serverless/bin/serverless.js

> spawn-sync@1.0.15 postinstall /usr/local/lib/node_modules/serverless/node_modules/spawn-sync
> node postinstall

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
    cachedCwd = binding.cwd();

Error: EACCES: permission denied, uv_cwd
    at process.cwd (internal/process/main_thread_only.js:42:25)
    at Object.resolve (path.js:979:47)
    at patchProcessObject (internal/bootstrap/pre_execution.js:83:28)
    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:11:3)
    at internal/main/run_main_module.js:7:1 {
  errno: -13,
  code: 'EACCES',
  syscall: 'uv_cwd'
npm ERR! errno 1
npm ERR! spawn-sync@1.0.15 postinstall: `node postinstall`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the spawn-sync@1.0.15 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:

I was able to do this before so I don’t know what I did wrong.


It sounds like some sort of permission error? I would post this over on the Serverless Framework issues page.

I am unable to install serverless as well!

vincefalk@Vinces-MacBook-Air ~ % npm install serverless -g
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
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!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/vincefalk/.npm/_logs/2021-05-27T04_19_58_229Z-debug.log