2

So I created a new NestJS application with the CLI. I got nodemon installed as a dependency and globally. My package.json looks like this:

"scripts": {
"build": "tsc -p tsconfig.build.json",
"format": "prettier --write \"src/**/*.ts\"",
"start": "ts-node -r tsconfig-paths/register src/main.ts",
"start:dev": "nodemon",
"start:debug": "nodemon --config nodemon-debug.json",

and my nodemon.json looks like this:

"watch": ["src"],
"ext": "ts",
"ignore": ["src/**/*.spec.ts"],
"exec": "ts-node -r tsconfig-paths/register src/main.ts"

So very basic setup. But if I try so start the dev server with: npm start:dev, I get this error message:

Usage: npm < command >

where < command > is one of:

access, adduser, audit, bin, bugs, c, cache, ci, cit,
clean-install, clean-install-test, completion, config,
create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
edit, explore, get, help, help-search, hook, i, init,
install, install-ci-test, install-test, it, link, list, ln,
login, logout, ls, org, outdated, owner, pack, ping, prefix,
profile, prune, publish, rb, rebuild, repo, restart, root,
run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami

Specify configs in the ini-formatted file: /Users/XXXXX/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

[email protected] /usr/local/lib/node_modules/npm

Did you mean this?
    start

My npmrc contains some credentials for my github repo from my job !

1
  • Because I could not find myself anything related to this after searching a lot, I created this comment on a somewhat related post stackoverflow.com/a/59803280/588003 . Commented Jan 18, 2020 at 17:51

1 Answer 1

15

To run a npm script you must call npm run. So call npm run start:dev.

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

1 Comment

@Maxstgt Glad it worked for you. :-) Consider accepting the answer so that others know your problem is solved. Of course, feel free to leave the question open and wait for other answers. stackoverflow.com/help/someone-answers

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.