Gulp Validator plugin failing to install.
I am unable to install the gulp-amphtml-validator plugin into my node project.
How do we reproduce the issue?
Environment: Windows 10.0.14393, Node 7.5.0 (latest), npm 4.1.2 (latest)
- Make a new empty folder and navigate to it with an administrator command prompt
npm init(accept all defaults)npm i --save gulp-amphtml-validator
Resulting error:
C:\Users\drasmussen\Documents\test-app>npm i --save gulp-amphtml-validator
> [email protected] postinstall C:\Users\drasmussen\Documents\test-app\node_modules\amphtml-validator
> /bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js
fs.js:907
return binding.stat(pathModule._makeLong(path));
^
Error: ENOENT: no such file or directory, stat 'C:\Users\drasmussen\AppData\Roaming\npm\amphtml-validator.cmd'
at Object.fs.statSync (fs.js:907:18)
at Object.<anonymous> (C:\Users\drasmussen\Documents\test-app\node_modules\amphtml-validator\postinstall-windows.js:36:16)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:418:7)
at startup (bootstrap_node.js:139:9)
[email protected] C:\Users\drasmussen\Documents\test-app
`-- [email protected] extraneous
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\drasmussen\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i" "--save" "gulp-amphtml-validator"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `/bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script '/bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the amphtml-validator package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! /bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs amphtml-validator
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls amphtml-validator
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\drasmussen\Documents\test-app\npm-debug.log
Here is the debug log: npm-debug.log
I have tried installing amphtml-validator globally, uninstalling it globally, installing the plugin globally, uninstalling the plugin globally—nothing seems to let me install the gulp plugin successfully.
Thank you for looking into this.
Does a standalone amphtml-validator installation succeed (npm -i amphtml-validator --save)? Can you run the amp validator via the CLI.
Yes to both:
C:\Users\drasmussen\Documents\test-app>npm i --save amphtml-validator
> [email protected] postinstall C:\Users\drasmussen\Documents\test-app\node_modules\amphtml-validator
> /bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js
postinstall-windows.js: No amphtml-validator shim found to modify.
[email protected] C:\Users\drasmussen\Documents\test-app
`-- [email protected]
+-- [email protected]
+-- [email protected]
| `-- [email protected]
`-- [email protected]
`-- [email protected]
C:\Users\drasmussen\Documents\test-app>node node_modules\amphtml-validator\index.js https://ampbyexample.com
https://ampbyexample.com: PASS
Looks like a bug in an older amphtml-validator version. Can your try:
npm i --save amphtml-validator gulp-amphtml-validator?
Will update the dependency.
I believe gulp-amphtml-validator just needs its dependency updated (perhaps to a looser version so it updates with the amphtml-validator itself?)
It appears it is trying to install both the old and new amphtml-validator versions, and failing on the second:
C:\Users\drasmussen\Documents\test-app>npm uninstall amphtml-validator
- [email protected] node_modules\asap
- [email protected] node_modules\colors
- [email protected] node_modules\graceful-readlink
- [email protected] node_modules\commander
- [email protected] node_modules\promise
- [email protected] node_modules\amphtml-validator
C:\Users\drasmussen\Documents\test-app>npm i --save amphtml-validator gulp-amphtml-validator
> [email protected] postinstall C:\Users\drasmussen\Documents\test-app\node_modules\amphtml-validator
> /bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js
postinstall-windows.js: No amphtml-validator shim found to modify.
> [email protected] postinstall C:\Users\drasmussen\Documents\test-app\node_modules\gulp-amphtml-validator\node_modules\amphtml-validator
> /bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js
fs.js:907
return binding.stat(pathModule._makeLong(path));
^
Error: ENOENT: no such file or directory, stat 'C:\Users\drasmussen\AppData\Roaming\npm\amphtml-validator.cmd'
at Object.fs.statSync (fs.js:907:18)
at Object.<anonymous> (C:\Users\drasmussen\Documents\test-app\node_modules\gulp-amphtml-validator\node_modules\amphtml-validator\postinstall-windows.js:36:16)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:418:7)
at startup (bootstrap_node.js:139:9)
[email protected] C:\Users\drasmussen\Documents\test-app
`-- [email protected]
+-- [email protected]
+-- [email protected]
| `-- [email protected]
`-- [email protected]
`-- [email protected]
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\drasmussen\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i" "--save" "amphtml-validator" "gulp-amphtml-validator"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `/bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script '/bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the amphtml-validator package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! /bin/sh -c "exit 0" 2> NUL && rm NUL || node postinstall-windows.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs amphtml-validator
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls amphtml-validator
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\drasmussen\Documents\test-app\npm-debug.log
Published the new version: https://www.npmjs.com/package/gulp-amphtml-validator
@sebastianbenz Thanks for the quick fix! This appears to be working as intended for me, now.