If I try and run the following in my docker setup
docker-compose run --rm npm run dev
I get the following error
> dev
> npm run development
glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
errno: -13,
code: 'EACCES',
syscall: 'scandir',
path: '/root/.npm/_logs'
}
> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-
modules --config=node_modules/laravel-mix/setup/webpack.config.js
sh: 1: cross-env: not found
npm ERR! code 127
npm ERR! path /var/www/html
npm ERR! command failed
npm ERR! command sh -c cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --
progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
Seems like a permissions issue but where how do I give permission for this, for root, uncertain where it is
This is the docker-compose.yml where I'm adding npm in docker so not sure where to give permission to /root/.npm/_logs as that seems to be in the application outside docker?
version: '3'
networks:
laravel:
services:
nginx:
image: nginx:stable-alpine
container_name: nginx
ports:
- "8080:80"
volumes:
- ./src:/var/www/html
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- php
- mysql
networks:
- laravel
mysql:
image: mysql:5.7.22
container_name: mysql
restart: unless-stopped
tty: true
ports:
- "3307:3306"
env_file:
- src/.env
networks:
- laravel
php:
build:
context: .
dockerfile: Dockerfile
container_name: php
volumes:
- ./src:/var/www/html
ports:
- "9000:9000"
networks:
- laravel
npm:
image: node:latest
container_name: npm
volumes:
- ./src:/var/www/html
working_dir: /var/www/html
entrypoint: [ 'npm', '--no-bin-links' ]
networks:
- laravel
/root/.npm/_logs.chmod -R 777 /root/.npm/_logsdocker pull node:latest