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

Can't install amphtml-validator 1.0.15 #6354

Closed
peterdotplus opened this issue Nov 28, 2016 · 5 comments · Fixed by #6402
Closed

Can't install amphtml-validator 1.0.15 #6354

peterdotplus opened this issue Nov 28, 2016 · 5 comments · Fixed by #6402
Assignees

Comments

@peterdotplus
Copy link

Short description of your issue:

After cloning the ampbyexample project the npm install failed on the amphtml-validator package. After some attempts I tried 1.0.14 and that installed without a problem. Updating from there didn't work for me either.

Tell the author that this fails on your system:
npm ERR! /bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js

How do we reproduce the issue?

Sadly don't know how to.. I didn't have anything of the ampproject on my machine and then wanted to clone and run the amp-by-example project. I don't think it has anything to do with me not having the amphtml project, but that is what I did. Running Windows 10, Node is at v6.9.1 and NPM is at v4.0.2 .

Which AMP version is affected?

I don't have the AMP project installed, but the amphtml-validator package I'm having issues with is at version 1.0.15

@powdercloud
Copy link
Contributor

powdercloud commented Nov 29, 2016

Thank you for the report! It's sad since 1.0.15 was the version that I specifically tweaked so it would work on Windows.
I wonder whether you have something else installed on your machine which makes this magic line that's supposed to invoke postinstall-windows.js fail. The sorts of things I'm thinking of in particular would be cygwin, windows services for unix, and other packages that try to make the Windows machine into something more like a Linux / Unix one. But since I don't have these things to try out right now it's just a guess. Can you provide any additional output from the failed installation attempt? Unfortunately the line that you mention is the trickiest one, so any additional clue would be great.

@uncompiled
Copy link

FWIW, I was able to re-create this issue on Windows 10 using both Node v6.9.1 and 7.2.0.

Inside a command prompt, I ran npm install amphtml-validator and received the same error:

> amphtml-validator@1.0.15 postinstall C:\Users\chris\test\node_modules\amphtml-validator
> /bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js

fs.js:987
  return binding.stat(pathModule._makeLong(path));

Error: ENOENT: no such file or directory, stat 'C:\Users\chris\AppData\Roaming\npm\amphtml-validator.cmd'

However, it works if installed globally using npm install -g amphtml-validator:

> amphtml-validator@1.0.15 postinstall C:\Users\chris\AppData\Roaming\npm\node_modules\amphtml-validator
> /bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js

postinstall-windows.js: Modified amphtml-validator for Windows.

@powdercloud
Copy link
Contributor

@uncompiled Thanks a ton!
So basically the package doesn't work if installed locally (without -g) on Windows because postinstall-windows.js assumes it's being installed globally. This should be fixable because it's not difficult to change the logic in postinstall-windows.js (the brittlest thing is the line that invokes it). Perhaps all that's needed is to gracefully bail when trying to modify the shim, or better yet, detect whether we're trying to install with -g or not. Will look into it unless someone else gets to it first.

@powdercloud
Copy link
Contributor

Looks like me merging the first attempt to fix auto-closed this issue. Just wanted to note here that #6416 was required as well to fix this. Also, the fixed version is now published as revision version 1.0.17 at https://www.npmjs.com/package/amphtml-validator.

@stephengardner
Copy link

stephengardner commented Feb 16, 2018

This issue seems to have resurfaced for me. Fresh build on windows 10 Node 8.9.3 fails on the amphtml-validator postinstall script. I have installed it globally and locally with success, but the ampstart package does not install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants