npm install 结果在 docker 中出错
npm install results to error in docker
我正在尝试为我的节点应用程序创建一个节点容器,并遵循了 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 install 中遇到错误
npm info it worked if it ends with ok
npm info using npm@2.15.1
npm info using node@v4.4.4
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
我正在尝试为我的节点应用程序创建一个节点容器,并遵循了 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 install 中遇到错误
npm info it worked if it ends with ok
npm info using npm@2.15.1
npm info using node@v4.4.4
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