Laravel docker npm ошибка возврата команды run dev - PullRequest
0 голосов
/ 05 августа 2020

Когда я запускаю docker команду:

docker-compose run --rm npm run dev

Получить ошибку сообщение:

> @ dev /var/www/html
> npm run development


> @ development /var/www/html
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

sh: cross-env: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-08-05T11_52_44_929Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-08-05T11_52_45_060Z-debug.log

docker -compose.yml

version: '3'

services:
  nginx:
    image: nginx:stable-alpine
    container_name: nginx
    ports:
      - "${HOST_PORT}:80"
    volumes:
      - ../:/var/www/html
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - php
  php:
    build:
      context: .
      dockerfile: ./Dockerfile
    container_name: php
    volumes:
      - ./php/php.ini:/usr/local/etc/php/conf.d/php.ini
      - ../:/var/www/html
  mongodb:
    image: mongo:latest
    container_name: mongodb
    ports:
      - "${MONGODB_PORT}:27017"
  redis:
    image: redis:latest
    container_name: redis
    restart: always
    ports:
      - "${REDIS_PORT}:6379"
  artisan:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: artisan
    volumes:
      - ../:/var/www/html
    working_dir: /var/www/html
    entrypoint: ['/var/www/html/artisan']
  npm:
    image: node:14-alpine
    container_name: npm
    volumes:
      - ../:/var/www/html
    working_dir: /var/www/html
    entrypoint: ['npm']

1 Ответ

0 голосов
/ 05 августа 2020

Я думаю, проблема в том, что пакет npm cross-env не найден или отсутствует.

https://www.npmjs.com/package/cross-env

Вы можете установить его звонок: npm i cross-env

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...