【问题标题】:Node JS ,Trying to installed forked github repo but failing , what is missing? [duplicate]Node JS,尝试安装分叉的 github repo 但失败,缺少什么? [复制]
【发布时间】:2021-08-20 10:38:54
【问题描述】:

我已经将this repo 分叉到我自己的this one 中来安装这个分叉的回购我已经尝试了像 npm install git+{giturl} npm install {user}/{repo} 这样的一切,但我最终得到以下错误: 注意:我正在尝试在 docker 环境中安装

docker-compose exec app npm install git+https://github.com/32xnabin/forward-deeplink.git

npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/32xnabin/forward-deeplink.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 

注意:我需要 git 安装的 docker image .. 解决了这个问题。

【问题讨论】:

  • 这是在 Windows 上吗?您可能需要安装 git
  • @Joe ubuntu 20.04 我有 git
  • 你的 docker 镜像是否安装了 git?
  • 您有一个名为 app 的 docker 容器,但它没有告诉我们它可能正在运行的图像或该容器中可能发生的情况。如果是你自己的 Dockerfile,你甚至都没有透露它的基础镜像是什么。您需要使用具有 git 的基础镜像,或者您需要将 RUN 命令添加到 Dockerfile 以在镜像中安装 git。
  • FROM node:12.8.0-alpine

标签: node.js git docker npm docker-compose


【解决方案1】:

Node Alpine 图像do not come with git installed。您可以自己将其安装到您的Dockerfile

FROM node:12.8.0-alpine

RUN apk --no-cache add git

# and so on

其他选项是使用基于 Debian 的映像之一,例如预装了 gitnode:12.8.0-buster


仅供参考 Node v12 即将停止维护。当前的 LTS 版本是 v14。见https://nodejs.org/en/about/releases/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-21
    • 1970-01-01
    • 2021-08-22
    • 2021-11-23
    相关资源
    最近更新 更多