07_05_GuyT
07_05_GuyT

Reputation: 2887

Run npm install with other commands for project

Is there a way to run a the command “npm install” which is under the hood Other command , like postinstall etc. I know that you can run npm run <scriptName> but Not sure how to run some command from the script section (of the package.json)during the npm install command.

I try to read about it, not find any hint... https://michael-kuehnel.de/tooling/2018/03/22/helpers-and-tips-for-npm-run-scripts.html

Upvotes: 0

Views: 1107

Answers (1)

Raja Sekar
Raja Sekar

Reputation: 2130

  "scripts": {
    "preinstall": "node pre.js",
    "postinstall": "node post.js"
  }

You can have a pre and post term before any command which will execute before and after the command. It can be any command

For Example:-

  "scripts": {
    "check1": "node run.js",
    "precheck1": "node pre.js",
    "postcheck1": "node post.js"
  }

Hope this solves your issue.

Upvotes: 3

Related Questions