【发布时间】:2019-08-27 09:18:52
【问题描述】:
我正在尝试从我的 GitHub 将 node.js 容器化应用程序部署到 Azure 应用程序服务并收到以下错误:npm ERR! enoent ENOENT:没有这样的文件或目录,打开'/home/site/wwwroot/package.json'。这是我的 GitHub 项目的链接:https://github.com/dukeace2005/proxy.git
当我从本地存储库手动创建 docker 映像,然后从 Azure 容器注册表手动部署时,一切正常。
Dockerfile:
FROM node:10.13-alpine
ENV NODE_ENV production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
COPY . .
EXPOSE 8080
CMD npm start
2019-08-26T05:46:09.861966773Z PATH="$PATH:/home/site/wwwroot" npm start
2019-08-26T05:46:09.866880267Z Checking if node_modules was compressed...
2019-08-26T05:46:09.867015467Z Done.
2019-08-26T05:46:11.001090444Z npm ERR! path /home/site/wwwroot/package.json
2019-08-26T05:46:11.001728443Z npm ERR! code ENOENT
2019-08-26T05:46:11.002710642Z npm ERR! errno -2
2019-08-26T05:46:11.003222742Z npm ERR! syscall open
2019-08-26T05:46:11.019177623Z npm ERR! enoent ENOENT: no such file or directory, open '/home/site/wwwroot/package.json'
2019-08-26T05:46:11.019901022Z npm ERR! enoent This is related to npm not being able to find a file.
2019-08-26T05:46:11.020380922Z npm ERR! enoent
【问题讨论】:
-
忘了提一下,当我手动创建容器时,我在 Windows 上使用 VS Code 中的 Docker 工具箱来执行此操作,同时我正在部署到 Linux 实例。就像我提到的那样,手动流程工作得很好,但是 CI/CD 失败了。
标签: node.js azure docker npm continuous-integration