简体   繁体   English

如何使用“ nodemon”和简单的“ node”命令而不使用“ npm start”命令来运行Express的脚手架?

[英]How to run express's scaffold using “nodemon” and simple “node” command, without using “npm start” command?

I think i have to change my package.json file but i don't know where? 我想我必须更改我的package.json文件,但我不知道在哪里? here is my package.json 这是我的package.json

{
  "name": "xyz",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "^1.13.3",
    "cookie-parser": "~1.3.5",
    "debug": "~2.2.0",
    "express": "~4.13.1",
    "jade": "~1.11.0",
    "mongoose": "^4.4.5",
    "morgan": "~1.6.1",
    "serve-favicon": "~2.3.0"
  }
}

Add an entry for main and as follows and do nodemon 为main添加条目,如下所示,并执行nodemon

{
  "name": "xyz",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "main": "./bin/www",
  "dependencies": {
    "body-parser": "^1.13.3",
    "cookie-parser": "~1.3.5",
    "debug": "~2.2.0",
    "express": "~4.13.1",
    "jade": "~1.11.0",
    "mongoose": "^4.4.5",
    "morgan": "~1.6.1",
    "serve-favicon": "~2.3.0"
  }
}

Then do 然后做

nodemon

This should now work exactly as npm start 现在这应该与npm start完全一样

Hope this helps! 希望这可以帮助!

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

相关问题 当 npm 开始使用 express 和 nodemon 时应用程序崩溃 - App crash when npm start using express and nodemon 如何在不使用npm install的情况下使用nodemon - How can I use nodemon without using npm install node-sass 不使用 npm run css 命令编译 scss 文件 - node-sass does not compile scss file using npm run css command React-native:[NODEMON] 启动 `babel-node src`,“babel-node”未被识别为内部或外部命令,而我运行“npm run dev” - React-native: [NODEMON] starting `babel-node src`, "babel-node" is not recognized as an internal or external command, while I run 'npm run dev' 使用相同的npm run命令动态运行多个javascript文件 - Run several javascript file dynamically using same npm run command 如何使用 node js 命令行运行多个 js 文件? - How to run multiple js file using node js command line? 在 nodejs 中使用 npm 开始的问题。 'nodemon' 不是内部或外部命令、可运行程序或批处理文件 - poblem with use the npm start in nodejs . 'nodemon' is not recognized as an internal or external command, operable program or batch file 如何使用命令提示符安装 npm - How to install npm using command prompt 使用“npm”安装“nodemon”时出错 - Error in installing 'nodemon' using 'npm' NPM ELIFECYCLE 错误 - 使用 node server.js 命令 - NPM ELIFECYCLE error - using node server.js command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM