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

postinstall task fails when installing on windows #516

Closed
molant opened this issue Sep 9, 2017 · 9 comments
Closed

postinstall task fails when installing on windows #516

molant opened this issue Sep 9, 2017 · 9 comments

Comments

@molant
Copy link

molant commented Sep 9, 2017

How to repro
Run npm install axe-core on a Windows machine in regular cmd (not Bash on Windows).

This is the output:

C:\Projects\tests>npm install axe-core

> [email protected] postinstall C:\Projects\tests\node_modules\axe-core
> ./bin/postinstall.sh

'.' is not recognized as an internal or external command,
operable program or batch file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\Projects\tests\package.json'
npm WARN tests No description
npm WARN tests No repository field.
npm WARN tests No README data
npm WARN tests No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `./bin/postinstall.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\antonmo\AppData\Roaming\npm-cache\_logs\2017-09-09T03_30_18_327Z-debug.log

This is the npm debug log:
2017-09-09T03_30_18_327Z-debug.txt

We are looking into updating to the latest version in https://github.com/sonarwhal/sonar, but the tool needs to run in any OS so we can't at the moment :(

@marcysutton
Copy link
Contributor

Dang, that's a bummer. It's true, the postinstall script would probably only work on Git Bash. Either we need to exclude that npm script and file if it isn't supported, or we need a way to differentiate between end-user installs and development installs. I'll have to look into this some more. What I was trying to avoid was having contributors miss the pre-commit hook in an opt-in npm script instead of running it automatically.

@marcysutton
Copy link
Contributor

@molant in the future can you keep an eye out for our alpha releases? We had two alpha versions of 2.4.0 before this was released–would have been a good opportunity to find out about the Windows problem. I've been posting about them on Twitter and tagging on https://github.com/dequelabs/axe-core/releases.

@molant
Copy link
Author

molant commented Sep 9, 2017

@molant in the future can you keep an eye out for our alpha releases?

Will do. We were relying on greenkeeper to get notifications of new versions but it hasn't notify us of anything for the last few weeks :/

Either we need to exclude that npm script and file if it isn't supported, or we need a way to differentiate between end-user installs and development installs.

Maybe have a small script that modifies package.json and removes the postscript action before publishing on npm and then restores it back?
We have a release script that automates all the process and does some changes like creating a npm-shrinkwrap.json file and remove it, etc. Maybe it can be helpful?

@dukhevych
Copy link

+1. Also postinstall script doesn't work on Git Bash.

@marcysutton
Copy link
Contributor

Maybe have a small script that modifies package.json and removes the postscript action before publishing on npm and then restores it back?

That sounds good. I'll work on it for our next patch release.

Really surprising it doesn't work in Git Bash....as an action item moving forward we'll see what we can do about running our tests on Windows using CI to catch this kind of stuff with minimal effort. #519

@molant
Copy link
Author

molant commented Sep 11, 2017

+1. Also postinstall script doesn't work on Git Bash.

Really surprising it doesn't work in Git Bash....

FWIW it works on my machine (tm) using build 16281 (latest public insider).

molant@DESKTOP-ANUL44G:~/Projects/tests$ npm install axe-core

> [email protected] postinstall /mnt/c/Projects/tests/node_modules/axe-core
> ./bin/postinstall.sh

+ [email protected]
added 5 packages in 21.099s

@nschonni
Copy link
Contributor

We use https://www.npmjs.com/package/in-publish for node-sass and then guard those scripts
https://github.com/sass/node-sass/blob/4a0f3d028c81ab355b9d2b75b76da14e7bf13725/package.json#L36

The scripts are just JS rather than Bash though

marcysutton pushed a commit to marcysutton/axe-core that referenced this issue Sep 11, 2017
marcysutton pushed a commit that referenced this issue Sep 12, 2017
marcysutton added a commit that referenced this issue Sep 12, 2017
* fix(postinstall): use node, more conditionals

Closes #516

* chore: move fs-extra to devDependencies
@marcysutton
Copy link
Contributor

Fixed with 2.4.1.

@molant
Copy link
Author

molant commented Sep 12, 2017

Thanks @marcysutton !

marcysutton added a commit that referenced this issue Dec 11, 2017
* fix(postinstall): use node, more conditionals

Closes #516

* chore: move fs-extra to devDependencies
marcysutton added a commit that referenced this issue Dec 12, 2017
* fix(postinstall): use node, more conditionals

Closes #516

* chore: move fs-extra to devDependencies
mrtnvh pushed a commit to mrtnvh/axe-core that referenced this issue Nov 24, 2023
…quelabs#516)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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