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

Unable to install sinon@16.1.1 #2557

Closed
awegrzyn opened this issue Oct 18, 2023 · 6 comments
Closed

Unable to install sinon@16.1.1 #2557

awegrzyn opened this issue Oct 18, 2023 · 6 comments

Comments

@awegrzyn
Copy link

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
Copy link

msaglietto commented Oct 18, 2023

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

MrArnoldPalmer added a commit to aws/aws-cdk that referenced this issue Oct 18, 2023
Add an explicit dependency on a version of sinon that we depend on in
other packages. This version is what is used by `aws-cdk-lib` currently.
This fixes an issue that occurs currently when installing
@aws-cdk-testing/cli-integ in a directory that is not a git repository
as described [in this issue](sinonjs/sinon#2557).

This doesn't occur during local development because yarn dedupes sinon
to a version that intersects with the peerDep range taken by
`ts-mock-imports` and versions depended on by other packages, such as
`aws-cdk-lib`.
mergify bot pushed a commit to aws/aws-cdk that referenced this issue Oct 18, 2023
Add an explicit dependency on a version of sinon that we depend on in other packages. This version is what is used by `aws-cdk-lib` currently. This fixes an issue that occurs currently when installing @aws-cdk-testing/cli-integ in a directory that is not a git repository as described [in this issue](sinonjs/sinon#2557).

This doesn't occur during local development because yarn dedupes sinon to a version that intersects with the peerDep range taken by `ts-mock-imports` and versions depended on by other packages, such as `aws-cdk-lib`. Also it's in a git repo.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
candrews added a commit to candrews/jumpstart that referenced this issue Oct 18, 2023
Sinon erroneously currently requires git to be installed: sinonjs/sinon#2557

However, sinon is a testing tool which should even be used anyways: mitre/saf#1919
candrews added a commit to candrews/jumpstart that referenced this issue Oct 18, 2023
Sinon erroneously currently requires git to be installed: sinonjs/sinon#2557

However, sinon is a testing tool which should even be used anyways: mitre/saf#1919
pipex added a commit to balena-io-modules/mahler that referenced this issue Oct 18, 2023
@pipex
Copy link

pipex commented Oct 18, 2023

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
Copy link
Contributor

fatso83 commented Oct 19, 2023

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

@fatso83
Copy link
Contributor

fatso83 commented Oct 19, 2023

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

@fatso83 fatso83 closed this as completed Oct 19, 2023
@franckOL
Copy link

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
Copy link
Contributor

fatso83 commented Oct 19, 2023

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?

Devhunter416 pushed a commit to Devhunter416/jumpstart that referenced this issue Mar 6, 2024
Sinon erroneously currently requires git to be installed: sinonjs/sinon#2557

However, sinon is a testing tool which should even be used anyways: mitre/saf#1919
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

5 participants