Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use `npm start` with --inspect flag?

Tags:

node.js

npm

Is there a way for me to run npm start and pass in the --inspect flag?

npm --inspect start doesn't work. Neither does npm start -- --inspect

like image 353
ericsoderstrom Avatar asked May 30 '18 22:05

ericsoderstrom


1 Answers

npm supports a node-options config value which is passed through using the NODE_OPTIONS environment variable. This environment variable is interpreted by NodeJS 8+. So if your package.json looks something like:

{
  ...
  "scripts": {
    "dev": "node src/index.js"
  },
  ...
}

then you can use

npm --node-options --inspect run dev
like image 183
Brian de Alwis Avatar answered Oct 28 '22 07:10

Brian de Alwis