0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Githubにある自作のnpmモジュールをnpm installしてENOENTなエラーが出た時

Last updated at Posted at 2022-01-08

はじまり

自分で作ったnpmモジュールをubuntu環境へinstallしようとしたときに以下のエラーが出ました。

log
root@ca04e13630cb:/usr/app# npm install git+https://github.com/Landmaster135/FeedFetcher.git
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -2
npm ERR! enoent An unknown git error occurred
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-01-08T17_49_46_172Z-debug-0.log

原因と解消法

僕の場合、gitがubuntu環境に入っていないことが原因だった。

console
apt install git-all -y

gitを入れた後は、以下の何れのコマンドでもnpm installできた。権限とかpackage.jsonの問題ではなかった。

console
npm install git+https://github.com/<user name>/<repo name>.git
console
npm install git+ssh://git@github.com/<user name>/<repo name>.git
console
npm install git+ssh://github.com/<user name>/<repo name>.git
console
npm install https://github.com/<user name>/<repo name>

おしまい

An unknown git error occurredとは、なんてスパルタな・・・。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?