Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 'spawn git ENOENT' while installing types/mysql2 #30

Open
ivo-andrade-sity opened this issue Jul 24, 2019 · 16 comments
Open

Error 'spawn git ENOENT' while installing types/mysql2 #30

ivo-andrade-sity opened this issue Jul 24, 2019 · 16 comments

Comments

@ivo-andrade-sity
Copy link

ivo-andrade-sity commented Jul 24, 2019

Hi! I'm fairly new with Node and Typescript in general and, while following a tutorial, I've encountered an issue trying to install types/mysql2 via the command npm i types/mysql2 -D

When running the command, I get the following error:

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 ssh://git@github.com/types/mysql2.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

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\[redacted path]\AppData\Roaming\npm-cache\_logs\2019-07-24T21_06_57_398Z-debug.log

The log file reads as follows:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'types/mysql2',
1 verbose cli   '-D' ]
2 info using npm@6.9.0
3 info using node@v10.16.0
4 verbose npm-session ffaebe21627f68a6
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for github:types/mysql2 Error while executing:
7 silly fetchPackageMetaData undefined ls-remote -h -t ssh://git@github.com/types/mysql2.git
7 silly fetchPackageMetaData
7 silly fetchPackageMetaData
7 silly fetchPackageMetaData spawn git ENOENT
8 timing stage:rollbackFailedOptional Completed in 0ms
9 timing stage:runTopLevelLifecycles Completed in 1172ms
10 verbose stack Error: spawn git ENOENT
10 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
10 verbose stack     at onErrorNT (internal/child_process.js:415:16)
10 verbose stack     at process._tickCallback (internal/process/next_tick.js:63:19)
11 verbose cwd C:\[redacted path, recipient folder for my DB]
12 verbose Windows_NT 10.0.17763
13 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "types/mysql2" "-D"
14 verbose node v10.16.0
15 verbose npm  v6.9.0
16 error path git
17 error code ENOENT
18 error errno ENOENT
19 error syscall spawn git
20 error enoent Error while executing:
20 error enoent undefined ls-remote -h -t ssh://git@github.com/types/mysql2.git
20 error enoent
20 error enoent
20 error enoent spawn git ENOENT
21 error enoent This is related to npm not being able to find a file.
22 verbose exit [ 1, true ]

Apparently it's an issue with the retrival of files from GitHub, but would like to be sure about it, since I've found nothing looking up for this issue. I appreciate the attention and help beforehand and hope you all are having a nice day! :)

@ivo-andrade-sity
Copy link
Author

ivo-andrade-sity commented Jul 25, 2019

Just as a heads up, I've tried this on two different setups by now, one was an Amazon EC2 instance running Windows Server and the other was a desktop running Windows 10, both with their own distinct internet connections.

Also, for the ones interested, this is the tutorial I've been following and didn't manage to complete: https://www.youtube.com/watch?v=4clEduk6OQM

@ivo-andrade-sity
Copy link
Author

Ok, this is more substancial now. I've instead tried to just add the dependency to the package.json of my project and run the command `npm install' instead. Here's my devDependencies:

"devDependencies": {
    [redacted, other devDependencies],
    "types/mysql2": "1.0.0"
  },

And then I get the following error for running npm install:

npm ERR! code EINVALIDPACKAGENAME
npm ERR! Invalid package name "types/mysql2": name can only contain URL-friendly characters

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-07-25T15_50_39_439Z-debug.log

Did I make any errors trying to install the package this way? Is there any means to have it manually installed?

@unional
Copy link

unional commented Jul 25, 2019

Would it be you have a firewall blocking the connection? I have tried it and it is ok.

@unional
Copy link

unional commented Jul 25, 2019

npm i types/mysql2

...
+ @types/mysql2@1.0.0
added 2 packages from 1 contributor and audited 3 packages in 4.623s
found 0 vulnerabilities

@ivo-andrade-sity
Copy link
Author

I've shut down the firewall (at least for the Amazon instance I'm working at atm), but no luck, same error.

@ivo-andrade-sity
Copy link
Author

I've been also attempting to use alternatives to the mysql2 while I'm facing this issue, but I'm also getting the same error while trying to install npm install mysqljs/mysql:

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 ssh://git@github.com/mysqljs/mysql.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.

Here's the error log saved in my AppData folder:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'mysqljs/mysql' ]
2 info using npm@6.9.0
3 info using node@v10.16.0
4 verbose npm-session 230f3c8bcdd16f91
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for github:mysqljs/mysql Error while executing:
7 silly fetchPackageMetaData undefined ls-remote -h -t ssh://git@github.com/mysqljs/mysql.git
7 silly fetchPackageMetaData
7 silly fetchPackageMetaData
7 silly fetchPackageMetaData spawn git ENOENT
8 timing stage:rollbackFailedOptional Completed in 0ms
9 timing stage:runTopLevelLifecycles Completed in 641ms
10 verbose stack Error: spawn git ENOENT
10 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
10 verbose stack     at onErrorNT (internal/child_process.js:415:16)
10 verbose stack     at process._tickCallback (internal/process/next_tick.js:63:19)
11 verbose cwd C:\Users\Administrator\Documents\Site-SITY-DB
12 verbose Windows_NT 10.0.17763
13 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "mysqljs/mysql"
14 verbose node v10.16.0
15 verbose npm  v6.9.0
16 error path git
17 error code ENOENT
18 error errno ENOENT
19 error syscall spawn git
20 error enoent Error while executing:
20 error enoent undefined ls-remote -h -t ssh://git@github.com/mysqljs/mysql.git
20 error enoent
20 error enoent
20 error enoent spawn git ENOENT
21 error enoent This is related to npm not being able to find a file.
22 verbose exit [ 1, true ]

@SupernaviX
Copy link

I'm also having trouble installing this module inside of my office. We have firewall rules explicitly preventing direct access to Github. Is there any way to install this through the npm registry instead?

@nekman
Copy link

nekman commented Nov 19, 2019

Fails on my companys CI server:

error	19-Nov-2019 21:48:29	npm ERR! code 128
error	19-Nov-2019 21:48:29	npm ERR! Command failed: git clone --mirror -q git://github.com/types/mysql2.git

Would be easier for us if we just could npm install @types/mysql2.

@jrjaca
Copy link

jrjaca commented Apr 11, 2020

Hi,

Good day!

I'm having the same error:
Here is what I did:
-disable firewall
-update nodejs
-clear cache of npm
-deleting node_modules folder

BUT still problem exist upon running 'npm install' command.

C:\xampp\htdocs\my-project>npm install
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 https://github.com/nhn/raphael.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

Please help.

Thank you.

@nmitra6
Copy link

nmitra6 commented Jun 11, 2020

typings showing version 1.1.1 is available but github authentication is stopping to download this version. version 1.0.0 is downloadable but showing many internal import errors inside index.d.ts.

Also some event emitting errors are present for windows.

Very difficult for a typescript project to import 'mysql2/promise' due to type definitions

@unional
Copy link

unional commented Jun 11, 2020

typings is deprecated. You should install using npm

@skunca
Copy link

skunca commented Jun 16, 2020

This package doesn't have a published package on npm so it installs directly from github.

Can you check that you have git installed and that it has access to your SSH key for access to github? Just doing git clone git@github.com:types/mysql2.git should verify this.

If you didn't intend to use SSH as an access mechanism you could update package.json to "@types/mysql2": "types/mysql2".

@winjay-yu-awx
Copy link

winjay-yu-awx commented Jul 2, 2020

I also encountered the same error

npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno -2
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/types/mysql2.git

@chpaulin
Copy link

chpaulin commented Jul 2, 2020

This package doesn't have a published package on npm so it installs directly from github.

Can you check that you have git installed and that it has access to your SSH key for access to github? Just doing git clone git@github.com:types/mysql2.git should verify this.

If you didn't intend to use SSH as an access mechanism you could update package.json to "@types/mysql2": "types/mysql2".

This solved it for me. Was building inside a docker container that did not have git 🤦

@LeoDoldan7
Copy link

Having to add git to the container just to install this one dependency is a pain. Me and probably many others will just uninstall the types. It'd be really useful being able to install it from npm.

@Louis5499
Copy link

This package doesn't have a published package on npm so it installs directly from github.
Can you check that you have git installed and that it has access to your SSH key for access to github? Just doing git clone git@github.com:types/mysql2.git should verify this.
If you didn't intend to use SSH as an access mechanism you could update package.json to "@types/mysql2": "types/mysql2".

This solved it for me. Was building inside a docker container that did not have git 🤦

Thanks for @chpaulin suggestion!
I've tried an alternative method to run apk add --no-cache git in front of npm install when using alpine image in the Dockerfile, which also works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests