sinonjs / sinon

Test spies, stubs and mocks for JavaScript.
https://sinonjs.org/
Other
9.64k stars 771 forks source link

Unable to install sinon@16.1.1 #2557

Closed awegrzyn closed 11 months ago

awegrzyn commented 11 months ago

OS: CentOS Stream release 8 NodeJS: v18.9.1 npm: 8.19.1

npm install simply fails with:

1958 verbose stack Error: command failed
1958 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:63:27)
1958 verbose stack     at ChildProcess.emit (node:events:513:28)
1958 verbose stack     at maybeClose (node:internal/child_process:1091:16)
1958 verbose stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
1959 verbose pkgid sinon@16.1.1
1960 verbose cwd <PATH>
1961 verbose Linux 4.18.0-448.el8.x86_64
1962 verbose node v18.9.1
1963 verbose npm  v8.19.1
1964 error code 128
1965 error path <PATH>/node_modules/sinon
1966 error command failed
1967 error command sh -c -- git config --replace-all core.hooksPath scripts/hooks
1968 error fatal: not in a git directory

No issue with sinon@16.1.0.

msaglietto commented 11 months ago

Same here .. It seems a git call was added to the postinstall "postinstall": "git config --replace-all core.hooksPath scripts/hooks" https://github.com/sinonjs/sinon/blob/main/package.json#L62

cc: @fatso83

pipex commented 11 months ago

Depending on the project. Adding ignore-scripts=true to .npmrc may work for you as a workaround (note that this disables all scripts from dependencies)

fatso83 commented 11 months ago

Good call! I'll fix it up. That postinstall was only supposed to affect people developing on Sinon 🙈

fatso83 commented 11 months ago

Verified to work. Sorry about the temporary glitch. Just try installing npm i sinon@latest

franckOL commented 11 months ago

I have issue on 16.1.2 and latest too:

npm i sinon@latest
npm ERR! code 1
npm ERR! path C:\_Utilisateurs\Project\Edge-AI\EECV-3DScene\node_modules\sinon
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c ./scripts/setup-hooks
npm ERR! '.' n'est pas reconnu en tant que commande interne
npm ERR! ou externe, un programme ex�cutable ou un fichier de commandes.
fatso83 commented 11 months ago

16.1.3 is the latest version. Can you show me the commands used? Start with removing node_modules

npm i sinon@16.1.3 -D 
# OK?