npm将无法启动:开发NestJS应用程序

问题描述 投票:1回答:1

所以我用CLI创建了一个新的NestJS应用程序。我将nodemon安装为依赖和全局。我的package.json看起来像这样:

"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",

而我的nodemon.json看起来像这样:

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

所以非常基本的设置。但是,如果我尝试使用:npm start:dev启动dev服务器,我收到此错误消息:

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

我的npmrc包含了我工作中github repo的一些凭据!

npm nodemon nestjs
1个回答
4
投票

要运行npm脚本,您必须调用npm run。所以请致电npm run start:dev

© www.soinside.com 2019 - 2024. All rights reserved.