shama / nodewebkit

:computer: An installer for node-webkit
https://github.com/rogerwang/node-webkit
152 stars 27 forks source link

NPM install on Windows fails with 'scripts' is not recognized as an internal or external command, operable program or batch file #5

Closed kenmerthe closed 11 years ago

kenmerthe commented 11 years ago

Trying to install node-webkit in a Windows project of mine and ran into this. I am using Windows 7 and npm v1.3.8. When running npm install nodewebkit I got:

npm WARN package.json test@0.0.0 No description
npm WARN package.json test@0.0.0 No repository field.
npm WARN package.json test@0.0.0 No README data
npm http GET https://registry.npmjs.org/zip
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/zip
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/graceful-fs
npm http 304 https://registry.npmjs.org/graceful-fs

> nodewebkit@0.7.5-2 postinstall G:\test\node_modules\nodewebkit
> scripts/install.js

'scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! weird error 1
npm ERR! not ok code 0

Googling around I found some related issues with other projects and it seems the postinstall example in the npm-scripts documentation isn't so Windows-friendy. Here is an actual GitHub issue with a committed fix.

https://github.com/bminer/node-blade/issues/43 https://github.com/bminer/node-blade/commit/2f4ce9f0dcba7c003dcffd84855628ce356954bd

You prepend "scripts/install.js" with "node" in the package.json. That worked for me when I tested a local clone of this project:

{
  "name": "nodewebkit",
  "version": "0.7.5-2",
  "description": "A installer for node-webkit",
  "bin": {
    "nodewebkit": "bin/nodewebkit"
  },
  "scripts": {
    "postinstall": "node scripts/install.js"
  },
  "author": "Kyle Robinson Young",
  "license": "MIT",
  "dependencies": {
    "rimraf": "~2.2.2",
    "zip": "~1.1.1",
    "mkdirp": "~0.3.5"
  },
  "keywords": [
    "node-webkit",
    "webkit",
    "installer",
    "desktop",
    "application"
  ]
}
kenmerthe commented 11 years ago

PS ... node-webkit is an awesome project and this project makes it even more awesome by making it easy to include in your project. Good job and kudos and all that. :)

shama commented 11 years ago

Interesting I thought npm would handle that for me. Fixed with the suggestion you provided. Let me know if any other issues arise. Thanks!

kenmerthe commented 11 years ago

Yeah me too ... I was surprised. I will. :)