Axe-core: postinstall task fails when installing on windows

Created on 9 Sep 2017  路  9Comments  路  Source: dequelabs/axe-core

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 :(

Most helpful comment

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

All 9 comments

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.

@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鈥搘ould 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 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?

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

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. https://github.com/dequelabs/axe-core/issues/519

+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

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

Fixed with 2.4.1.

Thanks @marcysutton !

Was this page helpful?
0 / 5 - 0 ratings