Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] when i install a package with -g i get a code EACCES error #5145

Closed
2 tasks done
ZeroXiphYT opened this issue Jul 11, 2022 · 1 comment
Closed
2 tasks done

[BUG] when i install a package with -g i get a code EACCES error #5145

ZeroXiphYT opened this issue Jul 11, 2022 · 1 comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@ZeroXiphYT
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When i do npm install -g nodemon it shows me this
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/nodemon
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/nodemon'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/nodemon'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/nodemon'
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/myname/.npm/_logs/2022-07-11T18_41_25_513Z-debug-0.log

Expected Behavior

Nodemon or any package should install as a global package

Steps To Reproduce

  1. In this environment iterm2/terminal
  2. With this config ; node bin location = /usr/local/bin/node
    ; node version = v16.16.0
    ; npm local prefix = /Users/myname/Desktop/e
    ; npm version = 8.13.2
    ; cwd = /Users/myname/Desktop/e
    ; HOME = /Users/myname
    ; Run npm config ls -l to show all defaults.
  3. Run 'npm i -g nodemon'
  4. See error npm ERR! code EACCES
    npm ERR! syscall mkdir
    npm ERR! path /usr/local/lib/node_modules/nodemon
    npm ERR! errno -13
    npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/nodemon'
    npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/nodemon'] {
    npm ERR! errno: -13,
    npm ERR! code: 'EACCES',
    npm ERR! syscall: 'mkdir',
    npm ERR! path: '/usr/local/lib/node_modules/nodemon'
    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/myname/.npm/_logs/2022-07-11T18_45_30_613Z-debug-0.log

Environment

  • npm: 8.13.2
  • Node.js: v16.16.0
  • OS Name: MacOs Monterey
  • System Model Name: Macbook Pro
  • npm config:
; node bin location = /usr/local/bin/node
; node version = v16.16.0
; npm local prefix = /Users/myname/Desktop/e
; npm version = 8.13.2
; cwd = /Users/myname/Desktop/e
; HOME = /Users/myname
@ZeroXiphYT ZeroXiphYT added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Jul 11, 2022
@ZeroXiphYT
Copy link
Author

i found a way to fix it from a youtube video, do

npm config get prefix
then do
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

1 participant