panthro panthro - 3 months ago 19
Javascript Question

Passing a param from cmd line to package.json

"scripts": {
"start": "gulp",

I'm using a package that runs via npm start. I want to pass params to the start command.

How can I pass the param in the command line?

npm start --myparam = hello

Alos, how can I access this in my package.jspn file to pass through to gulp:

"scripts": {
"start": "gulp --myparam",


If I understand your question correctly, you are trying to run gulp --myparam=hello with the npm start command.

The correct way to do this is npm start -- --myparam=hello.

Notice the -- in the command. Anything after the -- will be passed directly to the start command (gulp).

The reason for requiring the -- is that npm start (and npm run) can take parameters as well; like -s to silence the default output from npm.

Let me know if this doesn't correctly address your question.