Jenkins为什么会报error: enoent 这跟npm找不到文件有关?

编程入门 行业动态 更新时间:2024-10-03 06:31:57

Jenkins为什么<a href=https://www.elefans.com/category/jswz/34/1764788.html style=会报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找不到文件有关?

本文发布于:2024-05-30 16:24:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1770690.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:会报   找不到   这跟   文件   Jenkins

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!