会报error: enoent 这跟npm找不到文件有关?"/>
Jenkins为什么会报error: enoent 这跟npm找不到文件有关?
对于上下文,我多年来一直使用同一个 Dockerfile。
我目前正在使用 Jenkins 从 Github 仓库进行 CI/CD 部署。
唯一改变的是我最近从 node:18:14.1 -> node:20-slim -> node:20-bullseye-slim -> node:18.16.0-bullseye-slim。
我不知道为什么这很重要,但我把它放在这里以防它给任何人敲响警钟。我真的很感激任何帮助,因为我完全被困住了。请注意,这在本地工作得很好。
Docker文件:
# Download Node
FROM node:18.16.0-bullseye-slim
# Copy dependency definitions
COPY package.json /app/
WORKDIR /app
# Install dependecies
RUN npm install
# copy artifact build from the 'build environment'
COPY dist /app/public
COPY express /app
COPY src/assets /app/environments
COPY start /app
RUN apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade && apt-get install && apt-get -y install gettext-base
# Default environment variable for local testing
EXPOSE 80
# serve the appliction
#CMD ["node", "server.js"]
RUN ["chmod", "+x", "/app/start.sh"]
CMD [ "/bin/sh", "-c" , "/app/start.sh"]
完整错误:
#8 [ 4/10] RUN npm install
#8 digest:
sha256:
#8 name: "[ 4/10] RUN npm install"
#8 started: 2023-05-02 00:03:09.19464034 +0000 UTC
#8 22.79 npm notice
#8 22.79 npm notice New minor version of npm available! 9.5.1 -> 9.6.5
#8 22.79 npm notice Changelog:
<.6.5>
#8 22.79 npm notice Run `npm install -g [email protected]` to update!
#8 22.79 npm notice
#8 22.79 npm ERR! code ENOENT
#8 22.79 npm ERR! syscall spawn git
#8 22.79 npm ERR! path git
#8 22.79 npm ERR! errno -2
#8 22.80 npm ERR! enoent An unknown git error occurred
#8 22.80 npm ERR! enoent This is related to npm not being able to find a
file.
#8 22.80 npm ERR! enoent
#8 22.80
#8 22.80 npm ERR! A complete log of this run can be found in:
我尝试添加以下内容没有帮助:
- npm 安装-g npm
- npm 缓存清理 --force
- npm rm -rf node_modules
- npm rm package-lock.json
- npm 安装-g @angular/cli@latest
更多推荐
Jenkins为什么会报error: enoent 这跟npm找不到文件有关?
发布评论