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

Request for assistance: Issue installing npm for star tracker #2

Closed
BurgosCoralis-FS opened this issue Jan 23, 2024 · 1 comment
Closed
Assignees

Comments

@BurgosCoralis-FS
Copy link

Issue Description

When attempting to install the npm onto the node container I'm getting a EACCES error in my log as well as the console denying permissions for other actions.

How to reproduce

  • Create docker-compose.yml file
  • docker compose up -d
  • docker exec -it {container_id} /bin/bash
  • npm install -g @jworkman-fs/wdv-cli

Screenshots

Screenshot # 1

Screenshot 2024-01-23 at 6 49 09 PM

Screenshot # 2

Screenshot 2024-01-23 at 6 59 33 PM

Screenshot # 3

Screenshot 2024-01-23 at 6 59 43 PM

Screenshot # 4

Screenshot 2024-01-23 at 7 23 22 PM

Full Error Backtrace

node@3eea8f316777:~/app$ npm install -g @jworkman-fs/wdv-cli
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/@jworkman-fs
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@jworkman-fs'
npm ERR!     at async mkdir (node:internal/fs/promises:855:10)
npm ERR!     at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:551:20
npm ERR!     at async Promise.allSettled (index 0)
npm ERR!     at async [reifyPackages] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:251:11)
npm ERR!     at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:170:5)
npm ERR!     at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:152:5)
npm ERR!     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli-entry.js:61:5)
npm ERR!  Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@jworkman-fs'
npm ERR!     at async mkdir (node:internal/fs/promises:855:10)
npm ERR!     at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:551:20
npm ERR!     at async Promise.allSettled (index 0)
npm ERR!     at async [reifyPackages] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:251:11)
npm ERR!     at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:170:5)
npm ERR!     at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:152:5)
npm ERR!     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli-entry.js:61:5) {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/@jworkman-fs'
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: /home/node/.npm/_logs/2024-01-23T22_18_49_257Z-debug-0.log

Any Other Notes

Research performed

I understand the problem is being caused by some sort of issues with the permissions granted to the node user. However, I encountered another error, that I can't understand, when using admin/root (see screenshot 2 and 3).
This is a list of Overflow threads and other websites I visited while trying to fix the problem:

Docker-compose.yml

version: '3.8'

services:
  mariadb:
    image: mariadb:latest
    restart: always
    networks:
      - asl
    environment:
      MARIADB_ROOT_PASSWORD: root
  node:
    image: node:latest
    user: root
    working_dir: /home/root/app
    networks:
      - asl
    environment:
      - NODE_ENV=development
    volumes:
      - ./:/home/root/app
    ports:
      - "3000:3000"
    command: >
      sh -c "rm -rf node_modules && npm install && npm run watch"
    restart: always
    stdin_open: true
    tty: true
    depends_on:
      - mariadb

networks:
  asl:

Notes

Yesterday(2024/01/22), when following along with the activity I made the mistake of only starting a node docker container, I was able to install the package successfully (see screenshot 4) but because I forgot about mariadb, I couldn't perform the mysql commands. Today(2024/01/23), I tested this again on another node container and I got the same access errors.

@jworkman
Copy link
Owner

So the wdv-cli npm package was designed to be ran directly on the student's local install of NodeJS (not through Docker). This is because the commands available in the package are related to setting up a docker-compose.yml file on an existing project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants