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

Fails to install on Windows npm, pnpm, or yarn #183

Closed
aminya opened this issue May 9, 2021 · 0 comments · Fixed by #184
Closed

Fails to install on Windows npm, pnpm, or yarn #183

aminya opened this issue May 9, 2021 · 0 comments · Fixed by #184

Comments

@aminya
Copy link
Contributor

aminya commented May 9, 2021

The postinstall script uses sh which is not available in Windows by default. The code itself is pretty simple. Could you rewrite it in JavaScript itself? There is no need to depend on sh for such a simple script.

 pnpm i --save-dev @arkweid/lefthook
Packages: +1 -141
+--------------------------------------------------------------------------------------------------------------------------------
node_modules/.pnpm/@arkweid+lefthook@0.7.4/node_modules/@arkweid/lefthook: Running postinstall script, failed in 69ms
.../node_modules/@arkweid/lefthook postinstall$ node postinstall.js
 node:events:342
       throw er; // Unhandled 'error' event
       ^
 Error: spawn C:\Users\aminy\node_modules\.pnpm\@arkweid+lefthook@0.7.4\node_modules\@arkweid\lefth
     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
     at onErrorNT (node:internal/child_process:480:16)
     at processTicksAndRejections (node:internal/process/task_queues:83:21)
 Emitted 'error' event on ChildProcess instance at:
     at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
     at onErrorNT (node:internal/child_process:480:16)
     at processTicksAndRejections (node:internal/process/task_queues:83:21) {
   errno: -4058,
   code: 'ENOENT',
   syscall: 'spawn C:\\Users\\aminy\\node_modules\\.pnpm\\@arkweid+lefthook@0.7.4\\node_modules
   path: 'C:\\Users\\aminy\\node_modules\\.pnpm\\@arkweid+lefthook@0.7.4\\node_modules\\@arkwei
   spawnargs: [ 'install', '-f' ]
 }
└─ Failed in 69msERRORCommand failed with exit code 1.
Progress: resolved 22, reused 22, downloaded 0, added 0

The postinstall script itself is very simple. Not sure why pnpm fails to run it.

This the npmrc that I used in most of my projects:

public-hoist-pattern[]=*
package-lock=false
lockfile=true
prefer-frozen-lockfile=false
@aminya aminya changed the title Fails to install with pnpm Fails to install on Windows npm, pnpm, or yarn May 9, 2021
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

Successfully merging a pull request may close this issue.

1 participant