0

A script in my package.json

"start": "cross-env NODE_ENV=development PORT=3000 CODE_SPLIT=0 node ./react-imvc/bin/www-babel-register",

I need to start --inspect, for some reason, I can not modify the package.json, such as

"start": "cross-env NODE_ENV=development PORT=3000 CODE_SPLIT=0 node --inspect ./react-imvc/bin/www-babel-register"

I want to use script directly, like this :

npm run "cross-env NODE_ENV=development PORT=3000 CODE_SPLIT=0 node --inspect ./react-imvc/bin/www-babel-register"

using npm run script, but it failed.

How can I use npm script like above?

1
  • use: npm run start Commented Jul 24, 2017 at 6:16

2 Answers 2

1

assume that you want to run script with arg --inspect without changing the package.json:

npm run start -- --inspect

see:

$ npm run --help
npm run-script <command> [-- <args>...]

alias: run
Sign up to request clarification or add additional context in comments.

2 Comments

Yes, it works. but I wonder that wheter can I just using npm run "some script here, not start build here but what they refer to"
You can add "someScript": "some script here, not start build here but what they refer to" in scripts section including start, then just use npm run someScript.
0

So you want to execute the script you've got in your package.json which should look like this (after you've added the --inspect flag):

"scripts": {
  "start": "cross-env NODE_ENV=development PORT=3000 CODE_SPLIT=0 node --inspect ./react-imvc/bin/www-babel-register"
} 

This can be done by calling npm run start. Adding more scripts under another key lets you call them by using `npm run '.

1 Comment

node takes care of certain scripts like "run", "test" etc.. npm start should be fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.