Search code examples
scriptingnpmpost-install

npm install - how to trigger npm task as a post-install hook?


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?


Solution

  • 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",