【问题标题】:npm won't start:dev on NestJS applicationnpm 不会启动:NestJS 应用程序上的开发
【发布时间】:2019-08-02 03:18:37
【问题描述】:

所以我使用 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,我会收到以下错误消息:

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

npm@6.6.0 /usr/local/lib/node_modules/npm

Did you mean this?
    start

我的npmrc 包含我工作中的 github 存储库的一些凭据!

【问题讨论】:

  • 因为在搜索了很多之后我找不到任何与此相关的内容,所以我在一个有点相关的帖子stackoverflow.com/a/59803280/588003 上创建了这个评论。

标签: npm nodemon nestjs


【解决方案1】:

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

【讨论】:

  • @Maxstgt 很高兴它对你有用。 :-) 考虑接受答案,以便其他人知道您的问题已解决。当然,请随时将问题悬而未决并等待其他答案。 stackoverflow.com/help/someone-answers
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-29
  • 2021-04-07
  • 2020-08-31
  • 2022-07-13
  • 2012-07-10
  • 2021-04-23
相关资源
最近更新 更多