Permissions errors while using Nodejs

Viewed 2580

I am using npm inside a docker container with the user root however I am getting the two following errors:

glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path: '/root/.npm/_logs'
}

and

Error: EACCES: permission denied, open '/application/public/mix-manifest.json'
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/application/public/mix-manifest.json'
}

however root is the owner of the .npm and .npm/_logs folder:

~/
drwxr-xr-x 4 root root 4096 Mar 25 09:12 .npm

~/.npm/
drwxr-xr-x 2 root root 4096 Mar 25 09:18 _logs

and root has read/write access to the file /application/public/mix-manifest.json:

-rwxrwxr-x  1 www-data www-data  119 Mar 15 14:26 mix-manifest.json

What am I doing wrong?

My Dockerfile contains:

# Node + NPM
RUN curl -kfsSL https://deb.nodesource.com/setup_15.x | bash -
RUN apt-get install -y nodejs
1 Answers

Changing my dockerfile from

# Node + NPM
RUN curl -fsSL https://deb.nodesource.com/setup_15.x | bash -
RUN apt-get install -y nodejs

to

# Node + NPM
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs

fixed the problem.

Related