码头建设问题与npm安装,它只是内部的码头,我已经测试过。它在我的操作系统上运行得很好
错误
Step 6/8 : RUN npm cache clear --force && npm install --legacy-peer-deps
---> Running in 361c2a07ac22
npm WARN using --force Recommended protections disabled.
npm notice
npm notice New minor version of npm available! 8.4.1 -> 8.5.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.5.0>
npm notice Run `npm install -g npm@8.5.0` to update!
npm notice
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/styled-jsx: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-17T07_12_06_500Z-debug-0.log
The command '/bin/sh -c npm cache clear --force && npm install --legacy-peer-deps' returned a non-zero code: 1码头文件
FROM node:alpine
WORKDIR /app
ENV PORT 3000
COPY ./package.json /app/
COPY ./.npmrc ~
RUN npm cache clear --force && npm install --legacy-peer-deps
COPY . /app/
CMD ["npm", "start"]如您所见,我添加了.npmrc文件,因为我在某个地方读过它,但是它没有工作,或者添加了npm cache clear --force,所以我该怎么办?
发布于 2022-02-17 08:35:53
您的应用程序正在使用什么版本的Node?您在操作系统上安装了什么版本的节点?
您可以使用以下方法来检查它:
node -v您使用的这张图片是最新版本的节点,目前它是17,所以也许您应该使用旧的(您在您的应用程序中实际拥有的)。您可以在码头枢纽上找到正确的图像
https://stackoverflow.com/questions/71154015
复制相似问题