node-mysql2: mysql2@2.2.3 requires git installed, fails otherwise.
Our ci/cd failed because it seems like npm i --save mysql2@2.2.3 would fail if git is not installed on the server. i have reverted back to 2.1.0 for now.
npm debug log for reference,
60 verbose stack Error: spawn git ENOENT
60 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
60 verbose stack at onErrorNT (internal/child_process.js:469:16)
60 verbose stack at processTicksAndRejections (internal/process/task_queues.js:84:21)
60 verbose stack From previous event:
60 verbose stack at module.exports (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/util/finished.js:6:13)
60 verbose stack at /usr/local/lib/node_modules/npm/node_modules/pacote/lib/util/git.js:238:14
60 verbose stack at /usr/local/lib/node_modules/npm/node_modules/promise-retry/index.js:29:24
61 verbose cwd /app
62 verbose Linux 4.19.76-linuxkit
63 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "--save" "mysql2@2.2.3"
64 verbose node v12.18.3
65 verbose npm v6.14.6
66 error code ENOENT
67 error syscall spawn git
68 error path git
69 error errno ENOENT
70 error enoent Error while executing:
70 error enoent undefined ls-remote -h -t ssh://git@github.com/types/mysql.git
70 error enoent
70 error enoent
70 error enoent spawn git ENOENT
71 error enoent This is related to npm not being able to find a file.
72 verbose exit [ 1, true ]
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (11 by maintainers)
@itsTeknas
mysql2@2.2.4
should work without git runtimeThe latest release works as expected Thanks @sidorares and community, this was super fast.
@Bidthedog I suggest changing your compiler options to:
Thanks @sidorares and contributors/community for such a great package and fast development!
I personally feel bundling types ( at least for now ) is better option, gives me a bit more freedom with adding/removing types and at not a big cost in terms of package size
yes, I think moving type definitions to dev dependency would be a good solution for this. Alternatively we could publish our own version of
types/mysql
or maybe even add it to a repoyes, that would be great if you can help
suggest installing git on the server?
root cause: https://github.com/sidorares/node-mysql2/blob/master/package.json#L54 was added recently
@sidorares we could move the dependency to devDependencies, and rollup the typescript definition, if you like? I can help with a pull request for it