reactjs - 构建 docker 容器时反应应用程序错误
问题描述
错误:
=> ERROR [5/6] RUN npm install 143.3s
------
> [5/6] RUN npm install:
#9 143.0 npm notice
#9 143.0 npm notice New minor version of npm available! 7.15.1 -> 7.18.1
#9 143.0 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.18.1>
#9 143.0 npm notice Run `npm install -g npm@7.18.1` to update!
#9 143.0 npm notice
#9 143.0 npm ERR! code 254
#9 143.0 npm ERR! git dep preparation failed
#9 143.0 npm ERR! command /usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/root/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit
#9 143.0 npm ERR! npm WARN using --force Recommended protections disabled.
#9 143.0 npm ERR! npm WARN tarball tarball data for ethereumjs-abi@git+https://github.com/ProjectWyvern/ethereumjs-abi.git (null) seems to be corrupted. Trying again.
#9 143.0 npm ERR! npm WARN tarball tarball data for ethereumjs-abi@git+https://github.com/ProjectWyvern/ethereumjs-abi.git (null) seems to be corrupted. Trying again.
#9 143.0 npm ERR! npm WARN tarball tarball data for bignumber.js@git+https://github.com/frozeman/bignumber.js-nolookahead.git (null) seems to be corrupted. Trying again.
#9 143.0 npm ERR! npm WARN tarball tarball data for bignumber.js@git+https://github.com/frozeman/bignumber.js-nolookahead.git (null) seems to be corrupted. Trying again.
#9 143.0 npm ERR! npm ERR! code ENOENT
#9 143.0 npm ERR! npm ERR! syscall spawn git
#9 143.0 npm ERR! npm ERR! path git
#9 143.0 npm ERR! npm ERR! errno -2
#9 143.0 npm ERR! npm ERR! enoent spawn git ENOENT
#9 143.0 npm ERR! npm ERR! enoent This is related to npm not being able to find a file.
#9 143.0 npm ERR! npm ERR! enoent
#9 143.0 npm ERR!
#9 143.0 npm ERR! npm ERR! A complete log of this run can be found in:
#9 143.0 npm ERR! npm ERR! /root/.npm/_logs/2021-06-22T06_00_50_967Z-debug.log
#9 143.1
#9 143.1 npm ERR! A complete log of this run can be found in:
#9 143.1 npm ERR! /root/.npm/_logs/2021-06-22T06_01_02_702Z-debug.log
------
executor failed running [/bin/sh -c npm install]: exit code: 254
Dockerfile
# pull the base image
FROM node:alpine
# set the working direction
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install app dependencies
COPY package.json ./
COPY package-lock.json ./
RUN npm install
# add app
COPY . ./
# start app
CMD ["npm", "start"]
我正在使用下面的命令来运行它。
docker build -t ps-container:dev .
嗨,我在将我的 react 应用程序 dockerizing 以进行本地开发时遇到问题。我已经分享了错误和 Dockerfile。请看看我在哪里做错了。
我关注了https://www.pluralsight.com/guides/using-react.js-with-docker
文档,但仍然没有工作
请看一下。
解决方案
推荐阅读
- python - 如何从保存在 .aspx 下的网站下载图像
- java - Java 扫描器返回文件名而不是文件内容
- javascript - +(Math.round(1.005e2) +"e-2") 和 Math.round(1.005e2) / 100 之间有什么区别吗
- vba - 偶发错误更新或取消更新而没有添加新或编辑
- javascript - 使用 JavaScript 创建倒计时
- ssh - Puppet r10k:将 deploykey 放入 control-repo
- javascript - 将 JSON 添加到空数组问题
- process - Elixir,如何在单个 Supervisor 的监督下运行多个进程
- c++ - 无法标记字符串并将其传递给 c++ 中的 struct
- java - 使用 XStream 从 XML 中获取对象