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

deno install npm:simple-git-hooks --allow-scripts fails #28735

Closed
felipecrs opened this issue Apr 3, 2025 · 3 comments
Closed

deno install npm:simple-git-hooks --allow-scripts fails #28735

felipecrs opened this issue Apr 3, 2025 · 3 comments

Comments

@felipecrs
Copy link

Version: Deno 2.2.6

$ mkdir -p testproj

$ cd testproj

$ npm init -y

$ deno install -D npm:[email protected] --allow-scripts
Add npm:[email protected]
error: script 'postinstall' in '[email protected]' failed with exit code 1
stderr:
error: Uncaught (in promise) Error: ENOENT: no such file or directory, stat '/tmp/tmp.mbqgWP7o55/node_modules/.deno/[email protected]/package.json'
    at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:93:9)
    at __node_internal_uvException (ext:deno_node/internal/errors.ts:186:10)
    at denoErrorToNodeError (ext:deno_node/internal/errors.ts:1898:14)
    at Object.statSync (ext:deno_node/_fs/_fs_stat.ts:170:13)
    at _getPackageJson (file:///tmp/tmp.mbqgWP7o55/node_modules/.deno/[email protected]/node_modules/simple-git-hooks/simple-git-hooks.js:205:13)
    at checkSimpleGitHooksInDependencies (file:///tmp/tmp.mbqgWP7o55/node_modules/.deno/[email protected]/node_modules/simple-git-hooks/simple-git-hooks.js:128:34)
    at postinstall (file:///tmp/tmp.mbqgWP7o55/node_modules/.deno/[email protected]/node_modules/simple-git-hooks/postinstall.js:14:9)
    at Object.<anonymous> (file:///tmp/tmp.mbqgWP7o55/node_modules/.deno/[email protected]/node_modules/simple-git-hooks/postinstall.js:23:1)
    at Object.<anonymous> (file:///tmp/tmp.mbqgWP7o55/node_modules/.deno/[email protected]/node_modules/simple-git-hooks/postinstall.js:25:4)
    at Module._compile (node:module:745:34)

error: failed to run scripts for packages: [email protected]

This issue does NOT happen when using pnpm, so I'm reporting as a node compatibility issue.

@nathanwhit
Copy link
Member

That package has code that tries to figure out the package.json location from the node_modules directory https://github.com/toplenboren/simple-git-hooks/blob/1efca9232bc13e4443055045bf6ff7fa04445801/simple-git-hooks.js#L99-L131

It looks for a .pnpm directory to take into account the different directory structure, but it doesn't handle deno's node_modules structure correctly (which is very similar to the PNPM structure, but it has a .deno directory instead of .pnpm).

I opened a PR to the package to fix it

@nathanwhit nathanwhit removed the install label Apr 4, 2025
@littledivy
Copy link
Member

Looks like the upstream PR was merged. Can this be closed now?

@felipecrs
Copy link
Author

felipecrs commented Apr 10, 2025

For reference, here's the PR:

And yeah, that's great, this can be closed.

Thank you so much!!

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

4 participants