Skip to content

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

Closed
@ZeroXiphYT

Description

@ZeroXiphYT

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions