NPM 在 docker 容器内从 github 安装某些内容失败

2023-12-05

我一直在尝试从 github 存储库安装一些东西并在里面运行它。我用了npm install github:openfn/core#v1.0.0在我的项目目录中添加了"core": "github:openfn/core#v1.0.0"到 package.json。但是,当我尝试使用以下命令构建 docker 容器时docker build -t name .我收到以下警告并最终出现错误:

npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/pino-pretty-fddda985/.travis.yml'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/@babel/core-96a25426/lib/config/files/types.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/@babel/core-96a25426/lib/config/util.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/@babel/core-96a25426/lib/config/files/utils.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/no-unsupported-features/node-builtins.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/filter.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/prefer-global/process.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/configs/recommended-module.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/configs/recommended-script.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/configs/recommended.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/ajv-2fba4683/dist/ajv.min.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/util/strip-import-path-params.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/prefer-global/text-decoder.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/prefer-global/text-encoder.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/prefer-global/url-search-params.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/rules/prefer-global/url.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/util/visit-import.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/eslint-plugin-node-d3ce1706/lib/util/visit-require.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/getIterator.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/Heap.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/initialParams.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/prettier-21fddb45/doc.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/isArrayLike.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/iterator.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/map.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/once.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/onlyOnce.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/parallel.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/promiseCallback.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/queue.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/range.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/reject.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/setImmediate.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/withoutIndex.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/internal/wrapAsync.js'
npm WARN tar ENOENT: no such file or directory, open '/app/node_modules/.staging/async-67304d10/dist/async.mjs'
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://[email protected]/openfn/core.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

从这里的其他帖子中,我看到未定义的 ls-remote... 和 spawn git 可能与未安装 git 有关,但是我认为如果我没有使用 docker,那是有意义的,但即使如此我也这样做安装了 git 并且可以运行 git clone、git --version 等。正是由于这种依赖性,一旦我删除它,我就能够构建它并运行它而不会出现问题。有什么建议么?

编辑: 我的 Dockerfile 如下所示:

FROM node:dubnium-alpine

WORKDIR /app

COPY package.json package-lock.json ./

RUN npm install

COPY . .

CMD npm start 

EXPOSE 4321

我设法让它工作通过添加:

RUN apk add --no-cache git

到 dockerfile。不管怎样,谢谢你的时间。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

NPM 在 docker 容器内从 github 安装某些内容失败 的相关文章

  • 如何从CDN注入外部JS到Jest单元测试?

    我有 npm 和 webpack 的反应应用程序 我正在尝试向其添加单元测试 我使用的是包含在我的index html 中的CDN 的jQuery 而不是使用节点模块 我在组件中使用 jQueryTest1我向其中添加了单元测试用例 现在
  • 让 Express 服务器接受 CORS 请求

    我的 Express 服务器运行在 http localhost 3000 我称之为网络服务器 我有另一个应用程序在 localhost 8100 上运行 我简称为 应用程序 当我的应用程序调用网络服务器时 我收到以下消息 XMLHTTPR
  • 无法从外部访问在端口 4567 上的 Docker 容器中运行的应用程序

    使用重新创建设置所需的所有文件更新帖子 还是同样的问题 无法访问容器中运行的服务 FROM python 3 RUN apt get update RUN apt get install y ruby rubygems RUN gem in
  • 使用 node-sass 监视整个目录时指定输出文件名

    目前 我可以在查看单个 SCSS 文件时使用 package json 文件中的 node sass build 命令指定文件名 sass build node sass src scss main scss dist css main m
  • Node.js 在 Google Cloud Platform 上运行 Hello World 错误部署错误

    我在 Mac OSX Yosemite 上 当我执行以下步骤 运行 Hello World 时出现错误适用于 Google Cloud Platform 的 Node JS Hello World 教程 https cloud google
  • 自动执行异步函数

    下面的代码可以完美运行 const Course mongoose model Course courseSchema async function foo const nodeCourse new Course name Node JS
  • Git 中的数据完整性?

    我现在已经多次听到提到 Git 提供数据完整性 但是 这是什么意思 据我所知 git 中的所有对象都是使用 SHA 1 校验和来访问的 并且该校验和是根据文件的内容计算的 这意味着如果文件发生更改 您将得到不同的校验和 但这如何提供数据完整
  • 如何使用 Docker 和 DigitalOcean Spaces 部署 TensorFlow Serving

    如何配置 TensorFlow Serving 以使用存储在 DigitalOcean Spaces 中的文件 重要的是解决方案 提供对这两个配置的访问and模型文件 提供对数据的非公开访问 我已经配置了一个名为your bucket na
  • Bash 实例未嵌套在 Dockerfile `RUN` 中

    嵌套 bash 实例会递增 SLVL 环境变量 http tldp org LDP abs html internalvariables html http tldp org LDP abs html internalvariables h
  • 启动nodejs时出错:openssl配置失败

    启动 Express 节点时出现以下错误 openssl 配置失败 错误 02001003 系统库 fopen 没有这样的 过程 节点无论如何都会启动 我没有尝试使用 SSL 这是起始代码 app Express app set port
  • 检查 Git 中是否需要 pull

    如何检查远程存储库是否已更改并且需要拉取 现在我使用这个简单的脚本 git pull dry run grep q v Already up to date changed 1 但它比较重 有没有更好的办法 理想的解决方案是检查所有远程分支
  • 我应该在 Promise.all 中使用 wait 吗?

    我正在构建快速中间件 以对数据库进行两次异步调用 以检查用户名或电子邮件是否已在使用中 这些函数返回的承诺没有捕获 因为我想将数据库逻辑与 req res next 逻辑分开 并且我有集中的错误处理 需要next作为一个论点 在我对本地环境
  • 将命令行参数传递给 npm 'pre' 脚本和具有多个命令的脚本

    有没有办法将命令行参数传递给 npm pre 脚本或运行多个命令的脚本 假设一个简单的脚本mySexyScript js这只是注销 process argv console log process argv 这有效 使用 npm 脚本 sc
  • docker 容器中的“(pygame parachute)分段错误”

    尝试在 docker 容器中使用 pygame 时出现以下错误 我想从容器中获取显示 Fatal Python error pygame parachute Segmentation Fault 重现 Docker已安装 docker ru
  • Docker 容器与主机网络的网络性能非常慢

    我遇到了 Docker 容器和主机网络之间网络性能缓慢的问题 我在 Docker 论坛上提出了这个问题 但到目前为止还没有收到答案 Problem 设置 同一本地网络上的两台 Mac 第一个运行 MQTT 代理 mosquitto 第二个运
  • VS Code 在交互式变基期间不会等待我 [重复]

    这个问题在这里已经有答案了 如果我使用交互式变基git rebase i使用为 Git 配置的默认编辑器 一切都运行良好 如果我在我的全局中添加以下内容 gitconfig core editor C Program Files x86 M
  • Nodemailer:从未收到问候语

    当尝试使用 Nodemailer 在 Node 内发送电子邮件时 https github com nodemailer nodemailer https github com nodemailer nodemailer 调用sendMai
  • 如果您使用 CocoaPods,您的 .gitignore 中会包含什么内容?

    我从事 iOS 开发已经几个月了 刚刚了解到有前途的可可豆荚 http cocoapods org 用于依赖管理的库 我在个人项目上尝试过 添加了依赖项Kiwi https github com allending Kiwi到我的 Podf
  • 使用 IP 地址连接到另一台计算机

    我在计算机上安装了 NodeJS 并运行了一些测试 一切正常my机器 现在我想要一个不在同一网络中的朋友连接到我的计算机 以便 NodeJS 可以响应我朋友的请求 但我不知道 我必须在哪个IP和端口上监听 我也不知道 我必须给我的朋友哪个I
  • 每次我执行 docker compose up 时,Docker 都会创建一个新卷

    我有一个 docker compose 文件 可以启动多个服务 我刚刚收到一条错误消息 指出我的磁盘空间不足 因此我输入 docker system df 并看到我有 21 个卷 如果我有 3 个 docker 容器 每个容器都附加一个卷

随机推荐