我试图为我的节点应用程序制作一个节点容器,并遵循Nodejs网站enter link description here的示例
这是Dockerfile
FROM node:argon
ADD package.json /tmp/package.json
RUN cd /tmp
RUN npm config set registry https://registry.npmjs.org/
RUN npm install
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Install app dependencies
ADD . /usr/src/app/
EXPOSE 8080
CMD [ "npm", "start" ]
但是我在npm安装中出现错误
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm ERR! install Couldn't read dependencies
npm ERR! Linux 4.2.0-23-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.4
npm ERR! npm v2.15.1
npm ERR! path /package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! syscall open
npm ERR! package.json ENOENT: no such file or directory, open '/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! Please include the following file with any support request:
npm ERR! /npm-debug.log
最佳答案
我明白了..我必须在docker配置中更改dns
关于node.js - npm安装结果在docker中出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37480154/