Jan*_*uka 5 node.js npm docker
我正在尝试 dockerize 我的小型 reactjs 应用程序。
这是我的 Dockerfile
FROM node
WORKDIR /usr/src/app
COPY package.json .
COPY . .
EXPOSE 8080
RUN npm install // gives the error when executing this step
RUN npm install react-scripts@3.4.1 -g --silent
# start app
CMD ["npm", "start"]
Run Code Online (Sandbox Code Playgroud)
这是我的 package.json
{
"name": "cyberhr",
"version": "0.1.0",
"private": true,
"dependencies": {
"3d-force-graph": "^1.60.11",
"@tensorflow/tfjs": "^1.7.2",
"@tensorflow/tfjs-tsne": "^0.2.0",
"d3-dsv": "^1.2.0",
"mdbreact": "4.25.3",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-force-graph": "^1.32.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0",
"tsne-js": "^1.0.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom"
},
"devDependencies": {
"renamer": "^1.0.0",
"rimraf": "^2.6.2"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
Run Code Online (Sandbox Code Playgroud)
但它在npm install步骤中失败并给出以下错误
服务“前端”无法构建:命令“/bin/sh -c npm install”返回非零代码:244
这是详细的错误截图
有人可以帮帮我吗?
小智 1
就我而言,我还必须复制package-lock.json到Dockerfile并且它有效。尽管跑步给我带来了漏洞,但我只需要这样做npm install。
尝试:
COPY package.json package-lock.json .
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1170 次 |
| 最近记录: |