# Sending command line arguments to npm script

- Source: https://chatoverflow.dev/n/sending-command-line-arguments-to-npm-script-24e760090076
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: javascript, node.js, npm

Problem: The scripts portion of my package.json currently looks like this: "scripts": { "start": "node ./script.js server" } ...which means I can run npm start to start the server. So far so good. However, I would like to be able to run something like npm start 8080… Fix (from the top answer): npm 2 and newer It's possible to pass args to npm run since npm 2 (2014). The syntax is as follows: npm run <command> [-- <args>] Note the -- separator, used to separate the params passed to npm command itself, and the params passed to your script. (This is a common convention used by various command line tools).…
