docker - sh:1:混合:未找到-Docker-Compose
问题描述
尝试在 docker 中启动 npm 容器时,我不断遇到以下问题,我似乎无法弄清楚发生了什么。它不断尝试启动 npm,然后退出并且不运行。
| sh: 1: mix: not found
npm-aws | npm ERR! code ELIFECYCLE
npm-aws | npm ERR! syscall spawn
npm-aws | npm ERR! file sh
npm-aws | npm ERR! errno ENOENT
npm-aws | npm ERR! @ watch-poll: `mix watch -- --watch-options-poll=3000`
npm-aws | npm ERR! spawn ENOENT
npm-aws | npm ERR!
npm-aws | npm ERR! Failed at the @ watch-poll script.
npm-aws | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm-aws |
npm-aws | npm ERR! A complete log of this run can be found in:
npm-aws | npm ERR! /root/.npm/_logs/2021-10-05T22_43_50_263Z-debug.log
码头工人-compose.yml:
version: '3'
networks:
laravel:
services:
testing-aws:
build:
context: .
dockerfile: nginx.dockerfile
container_name: nginx-aws
ports:
- 5001:5001
volumes:
- ./src:/var/www/html:delegated
depends_on:
- php
- mysql
links:
- mysql
networks:
- laravel
mysql:
image: mysql:5.6
container_name: mysql-aws
restart: unless-stopped
tty: true
ports:
- 3306:3306
environment:
MYSQL_HOST: mysql
MYSQL_DATABASE: heatable
MYSQL_USER: heatable
MYSQL_ROOT_PASSWORD: password
networks:
- laravel
volumes:
- ./mysql:/var/lib/mysql
php:
build:
context: .
dockerfile: php.dockerfile
container_name: php-aws
volumes:
- ./src:/var/www/html:delegated
networks:
- laravel
links:
- mysql
depends_on:
- mysql
composer:
build:
context: .
dockerfile: composer.dockerfile
container_name: composer-aws
volumes:
- ./src:/var/www/html
working_dir: /var/www/html
depends_on:
- php
user: laravel
entrypoint: ['composer', '--ignore-platform-reqs']
networks:
- laravel
npm:
build:
context: .
dockerfile: npm.dockerfile
container_name: npm-aws
volumes:
- ./src:/var/www/html
working_dir: /var/www/html
command: npm run watch-poll
networks:
- laravel
artisan:
build:
context: .
dockerfile: php.dockerfile
container_name: artisan-aws
volumes:
- ./src:/var/www/html:delegated
depends_on:
- mysql
working_dir: /var/www/html
user: laravel
entrypoint: ['php', '/var/www/html/artisan']
links:
- mysql
networks:
- laravel
npm.docker 文件:
FROM node:14.17.1
WORKDIR /var/www/html
COPY ./src/package.json .
RUN npm install
RUN npm clean-install
CMD npm run watch-poll
更新
我设法通过添加来解决它tty: true
,请参阅更新:
npm:
tty: true
build:
context: .
dockerfile: npm.dockerfile
container_name: npm-aws
working_dir: /var/www/html
networks:
- laravel
npm install
如果有人知道没有手动输入命令的修复方法,我必须在容器的终端中手动运行才能获取节点模块。请告诉我 :)
解决方案
推荐阅读
- c++ - 单个程序中的 10 个线程或 1 个线程程序运行 10 次(C++)?
- wordpress - 如何在 API 响应中翻译订单状态
- python - 关于cv2。如何使 VideoWriter 保存为字节而不是输出文件?
- javascript - 在Javascript中格式化小数位的问题
- python - windows下的vaex二进制安装
- django - Treebeard - 找不到模块
- chart.js - Chartjs 在 x 轴上显示秒数,在 y 轴上显示音量
- javascript - 语法错误:意外的令牌 (21:4)
我第一次问关于stackoverflow的问题。我真的需要一些帮助。让我知道你需要我。我正在使用 React 框架 dva-js。该项目在 Windows 上运行良好。现在 git pull 在 Ubuntu 上,安装后出现错误。首先我在下面得到错误。我觉得这很奇怪,因为 Roadhog 应该包含 Babel。
"Mo
- typescript - TypeScript - 多个断言
- database - Mongoose 命令类似于关系数据库命令