shama/nodewebkit

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

kenmerthe opened this issue · 3 comments

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.

bminer/node-blade#43
bminer/node-blade@2f4ce9f

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"
  ]
}

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. :)

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

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