简体   繁体   English

npm dev:start 不运行

[英]npm dev:start does not run

I have the following scripts in my package.json我的package.json中有以下脚本

{
  "name": "demo-api",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "license": "MIT",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "NODE_ENV=development nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@nestjs/common": "^6.10.14",
    "@nestjs/core": "^6.10.14",
    "@nestjs/graphql": "^6.6.1",
    "@nestjs/jwt": "^6.1.2",
    "@nestjs/mongoose": "^6.3.1",
    "@nestjs/passport": "^6.2.0",
    "@nestjs/platform-express": "^6.10.14",
    "@types/graphql": "^14.5.0",
    "apollo-server-express": "^2.10.1",
    "class-transformer": "^0.2.3",
    "dotenv": "^8.2.0",
    "graphql": "^14.6.0",
    "graphql-tools": "^4.0.7",
    "mongoose": "^5.9.2",
    "passport": "^0.4.1",
    "passport-jwt": "^4.0.0",
    "passport-local": "^1.0.0",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.0",
    "rxjs": "^6.5.4",
    "type-graphql": "^0.17.6"
  },
  "devDependencies": {
    "@nestjs/cli": "^6.13.2",
    "@nestjs/schematics": "^6.8.1",
    "@nestjs/testing": "^6.10.14",
    "@types/express": "^4.17.2",
    "@types/jest": "25.1.2",
    "@types/mongoose": "^5.7.1",
    "@types/node": "^13.1.6",
    "@types/passport-jwt": "^3.0.3",
    "@types/passport-local": "^1.0.33",
    "@types/supertest": "^2.0.8",
    "@typescript-eslint/eslint-plugin": "^2.12.0",
    "@typescript-eslint/parser": "^2.12.0",
    "eslint": "^6.7.2",
    "eslint-config-prettier": "^6.7.0",
    "eslint-plugin-import": "^2.19.1",
    "jest": "^24.9.0",
    "prettier": "^1.18.2",
    "supertest": "^4.0.2",
    "ts-jest": "25.2.0",
    "ts-loader": "^6.2.1",
    "ts-node": "^8.6.0",
    "tsconfig-paths": "^3.9.0",
    "typescript": "^3.8.2",
    "typescript-tools": "^0.3.1"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".spec.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

When I try to run npm start:dev am getting the following error:当我尝试运行npm start:dev时出现以下错误:

git:(develop) 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, fund, 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

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

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

npm@6.13.7 /usr/local/lib/node_modules/npm

Did you mean this?
    start

Please use the following command whenever creating a custom scripts in每当在中创建自定义脚本时,请使用以下命令

npm run custom-script npm 运行custom-script

Eg: npm run start:dev例如: npm run start:dev

Hope it helps希望能帮助到你

You should follow some steps.您应该遵循一些步骤。 When I was stuck in this problem.当我陷入这个问题时。

if you are using node.js and React: step 1: you should write a script in package.json script -----> "dev": " node --watch node.js file (app.mjs)" Step 2: you should now go to your react file directory and then -----> run the command: npm run start dev it will automatically run your react file when you edit something in the project如果您正在使用 node.js 和 React:第 1 步:您应该在 package.json 脚本中编写脚本 -----> "dev": " node --watch node.js file (app.mjs)"第 2 步:您现在应该 go 到你的反应文件目录然后 -----> 运行命令: npm run start dev当你在项目中编辑某些东西时它会自动运行你的反应文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM