0

After npm install is run I would like to run

npm run jspm install

I have package.json

"scripts": {
    "postinstall" : "npm run jspm install",
    "jspm": "jspm"
},

This throws an error since npm run jspm install gets passed to node rather than npm. What's the correct way to do this?

George Mauer
  • 117,483
  • 131
  • 382
  • 612
  • Why not `"postinstall": "jspm install"` ? – Felix Kling Sep 10 '16 at 14:59
  • @FelixKling because that would make the assumption that jspm (and the proper version of jspm) is installed globally on the system – George Mauer Sep 10 '16 at 16:10
  • 1
    No, it will pick up the local version if it is installed (afaik). I mean, you have `"jspm": "jspm"` there as well. Why should `"jspm": "jspm"` work differently than `"postinstall": "jspm install"` ? – Felix Kling Sep 10 '16 at 16:21
  • @FelixKling hmm...good point, everything in npm scripts is pathed to the `node_modules` directory so yeah that should work. Feel free to make that an answer so I can mark it correct. – George Mauer Sep 10 '16 at 16:38

1 Answers1

1

There doesn't seem to be a reason to reference the jspm script. You can refer to jspm directly in the postinstall script:

"postinstall" : "jspm install",
Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
  • for any reason my start process fails because of this line. If I type "jspm installe" as single command on the command line it will work but as postinstall it will fail. Do you have an idea what could cause this behavior? – Ben Jan 20 '17 at 11:34