I'm working on a docker-compose project. The goal is to get a database running, connected to a an angular app through cubejs. The idea is to use cube's dashboard maker for the angular app. I've been able to get both the database and cubejs running and connected them. However, when I try to create the dashboard app from cube's playground I get EACCES errors from npm. I'm pretty sure it's a docker issue because npm's proposed solution is to chown a folder named '.npm' which I don't know where to find.
I'm posting the console's output when trying to create the dashboard app, as well as my docker-compose.yml file below.
Console output
cube_1 | npm ERR! code EACCES
cube_1 | npm ERR! syscall mkdir
cube_1 | npm ERR! path /.npm
cube_1 | npm ERR! errno -13
cube_1 | npm ERR!
cube_1 | npm ERR! Your cache folder contains root-owned files, due to a bug in
cube_1 | npm ERR! previous versions of npm which has since been addressed.
cube_1 | npm ERR!
cube_1 | npm ERR! To permanently fix this problem, please run:
cube_1 | npm ERR! sudo chown -R 1002:1002 "/.npm"
cube_1 | npm ERR! code EACCES
cube_1 | npm ERR! syscall mkdir
cube_1 | npm ERR! path /.npm
cube_1 | npm ERR! errno -13
cube_1 | npm ERR!
cube_1 | npm ERR! Your cache folder contains root-owned files, due to a bug in
cube_1 | npm ERR! previous versions of npm which has since been addressed.
cube_1 | npm ERR!
cube_1 | npm ERR! To permanently fix this problem, please run:
cube_1 | npm ERR! sudo chown -R 1002:1002 "/.npm"
cube_1 | npm ERR! code EACCES
cube_1 | npm ERR! syscall mkdir
cube_1 | npm ERR! path /.npm
cube_1 | npm ERR! errno -13
cube_1 | npm ERR!
cube_1 | npm ERR! Your cache folder contains root-owned files, due to a bug in
cube_1 | npm ERR! previous versions of npm which has since been addressed.
cube_1 | npm ERR!
cube_1 | npm ERR! To permanently fix this problem, please run:
cube_1 | npm ERR! sudo chown -R 1002:1002 "/.npm"
cube_1 | npm ERR! code EACCES
cube_1 | npm ERR! syscall mkdir
cube_1 | npm ERR! path /.npm
cube_1 | npm ERR! errno -13
cube_1 | npm ERR!
cube_1 | npm ERR! Your cache folder contains root-owned files, due to a bug in
cube_1 | npm ERR! previous versions of npm which has since been addressed.
cube_1 | npm ERR!
cube_1 | npm ERR! To permanently fix this problem, please run:
cube_1 | npm ERR! sudo chown -R 1002:1002 "/.npm"
cube_1 | npm ERR! code EACCES
cube_1 | npm ERR! syscall mkdir
cube_1 | npm ERR! path /.npm
cube_1 | npm ERR! errno -13
cube_1 | npm ERR!
cube_1 | npm ERR! Your cache folder contains root-owned files, due to a bug in
cube_1 | npm ERR! previous versions of npm which has since been addressed.
cube_1 | npm ERR!
cube_1 | npm ERR! To permanently fix this problem, please run:
cube_1 | npm ERR! sudo chown -R 1002:1002 "/.npm"
cube_1 | npm ERR! code EACCES
cube_1 | npm ERR! syscall mkdir
cube_1 | npm ERR! path /.npm
cube_1 | npm ERR! errno -13
cube_1 | npm ERR!
cube_1 | npm ERR! Your cache folder contains root-owned files, due to a bug in
cube_1 | npm ERR! previous versions of npm which has since been addressed.
cube_1 | npm ERR!
cube_1 | npm ERR! To permanently fix this problem, please run:
cube_1 | npm ERR! sudo chown -R 1002:1002 "/.npm"
cube_1 | npm ERR! code EACCES
cube_1 | npm ERR! syscall mkdir
cube_1 | npm ERR! path /.npm
cube_1 | npm ERR! errno -13
cube_1 | npm ERR!
cube_1 | npm ERR! Your cache folder contains root-owned files, due to a bug in
cube_1 | npm ERR! previous versions of npm which has since been addressed.
cube_1 | npm ERR!
cube_1 | npm ERR! To permanently fix this problem, please run:
cube_1 | npm ERR! sudo chown -R 1002:1002 "/.npm"
cube_1 | npm ERR! code EACCES
cube_1 | npm ERR! syscall mkdir
cube_1 | npm ERR! path /.npm
cube_1 | npm ERR! errno -13
cube_1 | npm ERR!
cube_1 | npm ERR! Your cache folder contains root-owned files, due to a bug in
cube_1 | npm ERR! previous versions of npm which has since been addressed.
cube_1 | npm ERR!
cube_1 | npm ERR! To permanently fix this problem, please run:
cube_1 | npm ERR! sudo chown -R 1002:1002 "/.npm"
cube_1 | npm ERR! code EACCES
cube_1 | npm ERR! syscall mkdir
cube_1 | npm ERR! path /.npm
cube_1 | npm ERR! errno -13
cube_1 | npm ERR!
cube_1 | npm ERR! Your cache folder contains root-owned files, due to a bug in
cube_1 | npm ERR! previous versions of npm which has since been addressed.
cube_1 | npm ERR!
cube_1 | npm ERR! To permanently fix this problem, please run:
cube_1 | npm ERR! sudo chown -R 1002:1002 "/.npm"
cube_1 | npm ERR! code EACCES
cube_1 | npm ERR! syscall mkdir
cube_1 | npm ERR! path /.npm
cube_1 | npm ERR! errno -13
cube_1 | npm ERR!
cube_1 | npm ERR! Your cache folder contains root-owned files, due to a bug in
cube_1 | npm ERR! previous versions of npm which has since been addressed.
cube_1 | npm ERR!
cube_1 | npm ERR! To permanently fix this problem, please run:
cube_1 | npm ERR! sudo chown -R 1002:1002 "/.npm"
cube_1 | Error: npm install failed with exit code 243. Please check your console.
cube_1 | at ChildProcess.<anonymous> (/cube/node_modules/#cubejs-backend/shared/src/helpers.ts:29:11)
cube_1 | at ChildProcess.emit (events.js:400:28)
cube_1 | at maybeClose (internal/child_process.js:1088:16)
cube_1 | at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
docker-compose.yml
version: '2.2'
services:
clickhouse_server:
user: "${UID}:${GID}"
image: clickhouse/clickhouse-server
ports:
- "8123:8123"
volumes:
- ./db:/var/lib/clickhouse
cube:
user: "${UID}:${GID}"
image: cubejs/cube
# ignored because of network_mode
# ports:
# - 3000:3000
# - 4000:4000
env_file: .env
volumes:
- .:/cube/conf
- .empty:/cube/conf/node_modules/#cubejs-backend/
depends_on:
- clickhouse_server
network_mode: "host" # may be linux specific
I've tried adding a volume for cubejs node_modules folder, which didn't work. I've also tried running docker-compose exec cube npm install --save #cubejs-client/ngx which prints the same EACCES errors the dashboard app maker does, and docker-compose exec cube npm update which prints
┌──────────────────────────────────────────────┐
│ npm update check failed │
│ Try running with sudo or get access │
│ to the local update config store via │
│ sudo chown -R $USER:$(id -gn $USER) /.config │
└──────────────────────────────────────────────┘
I'm working on Debian 11 in case it matters.
Also, cubejs image's node and npm versions are 14.21.1 and 6.14.17 respectively.
Related
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! stack:
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! 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! /home/andybod/.npm/_logs/2021-11-01T08_46_14_576Z-debug.log
You tried to write to the folder where your user doesn't have such permissions (/usr)
Just use sudo for this purpose
sudo npm install -g yarn
I am almost new to docker-compose. I need to create a yml file, for creating and configuring my container, but I faced a npm error related when trying to run a container from my image.
I already have a container running, having these content:
node#7b822f0c11d8:/usr/src/osjs$ ls
CONTRIBUTING.md LICENSE dist entrypoint.sh package-lock.json packages.json src webpack.config.js
Dockerfile README.md docker-compose.yml node_modules package.json session-store.db vfs
I have created an image from my container by using docker commit command.
Here is my image:
REPOSITORY TAG IMAGE ID CREATED SIZE
hafez/hafez version1.1 528fd0061a33 4 seconds ago 923MB
I put my yml and config files in myDirectory. Here is the output of ls in myDirectory:
config1.js config2.js my-docker-compose.yml
This is the my-docker-compose.yml content:
version: "3"
services:
hafez:
image: hafez/hafez:version1.1
restart: always
container_name: hafez
ports:
- 8000:8000
volumes:
- ./config1.js:/usr/src/osjs/src/client/config.js
- ./config2.js:/usr/src/osjs/src/server/config.js
And here is the output of docker-compose -f my-docker-compose.yml up:
Creating hafez ... done
Attaching to hafez
hafez | npm WARN saveError ENOENT: no such file or directory, open '/usr/src/osjs/package.json'
hafez | npm WARN saveError EACCES: permission denied, open '/usr/src/osjs/package-lock.json.1134850457'
hafez | npm WARN enoent ENOENT: no such file or directory, open '/usr/src/osjs/package.json'
hafez | npm WARN osjs No description
hafez | npm WARN osjs No repository field.
hafez | npm WARN osjs No README data
hafez | npm WARN osjs No license field.
hafez |
hafez | up to date in 1.506s
hafez | found 0 vulnerabilities
hafez |
hafez | npm ERR! code ENOENT
hafez | npm ERR! syscall open
hafez | npm ERR! path /usr/src/osjs/package.json
hafez | npm ERR! errno -2
hafez | npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/osjs/package.json'
hafez | npm ERR! enoent This is related to npm not being able to find a file.
hafez | npm ERR! enoent
hafez |
hafez | npm ERR! A complete log of this run can be found in:
hafez | npm ERR! /home/node/.npm/_logs/2021-09-17T11_15_37_791Z-debug.log
hafez | npm ERR! code ENOENT
hafez | npm ERR! syscall open
hafez | npm ERR! path /usr/src/osjs/package.json
hafez | npm ERR! errno -2
hafez | npm ERR! enoent ENOENT: no such file or directory, open '/usr/src/osjs/package.json'
hafez | npm ERR! enoent This is related to npm not being able to find a file.
hafez | npm ERR! enoent
hafez |
hafez | npm ERR! A complete log of this run can be found in:
hafez | npm ERR! /home/node/.npm/_logs/2021-09-17T11_15_38_196Z-debug.log
hafez | Usage: nodemon [nodemon options] [script.js] [args]
hafez |
hafez | See "nodemon --help" for more.
hafez |
How can I fix this error and create/config container successfully?
$ docker run -p 3000:3000 -v "/app/node_modules" -v "$(pwd):/app" 4a1158abb76e
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /app/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-05-07T07_33_16_702Z-debug.log
I am trying to install Bower. Need Bower to install zurb Foundation. I am a newbie in this, a UX designer learning the frontend.
npm install - g bower
npm ERR! Error: not_found document not found: -
npm ERR! at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:308:14)
npm ERR! at Request._callback (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:246:65)
npm ERR! at Request.self.callback (/usr/local/lib/node_modules/npm/node_modules/request/request.js:236:22)
npm ERR! at Request.emit (events.js:98:17)
npm ERR! at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1142:14)
npm ERR! at Request.emit (events.js:117:20)
npm ERR! at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/request.js:1096:12)
npm ERR! at IncomingMessage.emit (events.js:117:20)
npm ERR! at _stream_readable.js:944:16
npm ERR! at process._tickCallback (node.js:442:13)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Darwin 12.6.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-" "g" "bower"
npm ERR! cwd /Users/anandka
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/anandka/npm-debug.log
npm ERR! not ok code 0
Thanks in advance :)
You have a typo, you must remove the space before the g option.
npm is not finding package -, so:
npm install -g bower
I am trying to create cordova using the terminal but I am getting following error.
So far I know this is the only user account which we had created and intact should
be the root account
install -g cordova
npm http GET https://registry.npmjs.org/cordova
npm http 304 https://registry.npmjs.org/cordova
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/cordova'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/cordova']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/cordova',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/cordova',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm ERR! cwd /Users/anantmac
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /usr/local/lib/node_modules/cordova
npm ERR! fstream_path /usr/local/lib/node_modules/cordova
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/cordova'
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/anantmac/npm-debug.log
npm ERR! not ok code 0
Anants-MacBook-Air:~ anantmac$
Sometimes when installing node packages you need to use sudo so everything can write to the paths required, try this:
sudo npm install -g cordova