Skip to content

[BUG] <EACCES permissions errors when installing packages, npm is trying to use /.npm as its cache directory, which typically requires root permission > #7572

Closed
@kavana-14

Description

@kavana-14

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

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /.npm
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1007390000:0 "/.npm"

npm ERR! Log files were not written due to an error writing to the directory: /.npm/_logs
npm ERR! You can rerun the command with --loglevel=verbose to see the logs in your terminal

Expected Behavior

The issue arises because npm is trying to use /.npm as its cache directory, which typically requires root permissions. I'm try to create a react app on openshift, but after deployment when I rsh into my container shell and execute the npm start command i'm getting the error /.npm EACCESS. How to solve it .
The npm cache directory is set to a location where the user has appropriate permissions, avoiding permission issues.

Steps To Reproduce

  1. In this environment...
  2. With this config...
  3. Run '...'
  4. See error...

Environment

  • npm: 9.5.1
  • Node.js: 18.16.0
  • OS Name: ubuntu 22.04
  • System Model Name: Windows 10
  • npm config:
$ npm config ls
; node bin location = /usr/local/bin/node
; node version = v18.16.0
; npm local prefix = /home/node/app
; npm version = 9.5.1
; cwd = /home/node/app
; HOME = /
; Run `npm config ls -l` to show all defaults

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions