npm postinstall-script path doesn’t work on Windows
fraincs opened this issue · 8 comments
The error in the console is
npm ERR! not ok code 0
seems to crash while installing coffee-script
Here is the last lines of the npm-debug.log
44318 verbose lock underscore.string@~2.3.1 C:\Users\francis\AppData\Roaming\npm-cache\b2b19648-underscore-string-2-3-1.lock
44319 info install cookie-signature@1.0.1
44320 verbose readDependencies using package.json deps
44321 verbose from cache C:\wamp\www\init\node_modules\bower\node_modules\request\node_modules\oauth-sign\package.json
44322 info install pause@0.0.1
44323 verbose readDependencies using package.json deps
44324 verbose from cache C:\wamp\www\init\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\package.json
44325 info install inherits@2.0.1
44326 info install hoek@0.9.1
44327 silly addNameRange { name: 'cryptiles', range: '>=0.2.0- <0.3.0-', hasData: false }
44328 silly addNameRange { name: 'mime', range: '>=1.2.9- <1.3.0-', hasData: false }
44329 silly addNameRange { name: 'sntp', range: '>=0.2.0- <0.3.0-', hasData: false }
44330 silly addNameRange { name: 'hoek', range: '>=0.9.0- <0.10.0-', hasData: false }
44331 silly addNameRange { name: 'boom', range: '>=0.4.0- <0.5.0-', hasData: false }
44332 verbose readDependencies using package.json deps
44333 verbose from cache C:\wamp\www\init\node_modules\bower\node_modules\request\node_modules\qs\package.json
44334 error error rolling back Error: ENOTEMPTY, rmdir 'C:\wamp\www\init\node_modules\bower\node_modules\request\node_modules\mime'
44334 error error rolling back request@2.27.0 { [Error: ENOTEMPTY, rmdir 'C:\wamp\www\init\node_modules\bower\node_modules\request\node_modules\mime']
44334 error error rolling back errno: 53,
44334 error error rolling back code: 'ENOTEMPTY',
44334 error error rolling back path: 'C:\wamp\www\init\node_modules\bower\node_modules\request\node_modules\mime' }
44335 verbose about to build C:\wamp\www\init\node_modules\bower
44336 info C:\wamp\www\init\node_modules\bower unbuild
44337 verbose from cache C:\wamp\www\init\node_modules\bower\package.json
44338 info preuninstall bower@1.2.8
44339 error EEXIST, mkdir 'C:\wamp\www\init\node_modules\bower\node_modules\request\node_modules\json-stringify-safe'
File exists: C:\wamp\www\init\node_modules\bower\node_modules\request\node_modules\json-stringify-safe
Move it away, and try again.
44340 error System Windows_NT 6.2.9200
44341 error command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
44342 error cwd C:\wamp\www\init
44343 error node -v v0.10.5
44344 error npm -v 1.2.18
44345 error path C:\wamp\www\init\node_modules\bower\node_modules\request\node_modules\json-stringify-safe
44346 error fstream_path C:\wamp\www\init\node_modules\bower\node_modules\request\node_modules\json-stringify-safe\README.md
44347 error fstream_type File
44348 error fstream_class FileWriter
44349 error code EEXIST
44350 error errno 47
44351 error fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:171:23
44351 error fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\mkdirp\index.js:37:53
44351 error fstream_stack Object.oncomplete (fs.js:107:15)
44352 verbose exit [ 47, true ]
Thanks for reporting. I'll try to figure out a solution soon…
Additionnal info while I retried npm install flushing all my node modules folder and I get a more verbose error :
cmd "/c" "node_modules/.bin/bower_install" failed with 1
failt at the init@1.1.0 postintall script
...
command "c:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
...
there is really four \ in between nodejs and node.exe this seems weird to me
the paths are good though (the files referenced exists and are exactly where it is looking)
Yeah the issue is Windows seems not to be able to deal with given relative the postinstall script path. You can fix this manually by providing the absolute filepath of your local bower installation in package.json. Though I’d be interested how to fix that cross-OS – if you find an applicable solution please let me know while I’m trying to find a solution.
Solved using this : linnovate/mean#43
I changed the postinstall value to include node.exe - "postinstall": "node.exe node_modules/bower/bin/bower install"
not sure I can find an universal way maybe detect the environment (is it even possible?)
Thank you so much for posting the solution. I’ll leave the issue open and will try to find out how we can solve this in our cross-OS approach. It should also be added to our docs. Thanks again for reporting.
No problem I love the init project so far will test later a known bug with imagemin(Windows only) and report a bug if it does it (and a solution)
Edit : all good the fix I had for Windows and imagemin is not needed anymore!
We could handly this by providing a custom .js script as posthook which calls the bower tool depending on npm’s OS type function