nodemon 无法使用 express v4 启动 nodejs 应用程序
nodemon not able to start nodejs app with express v4
这个问题一定有一些简单的解决方法。我已经使用 Webstorm 为 Express js + Node js 创建了一个新项目。然后我使用 npm install -g nodemon
安装了 nodemon 并且没问题。但是当我尝试使用 nodemon app.js
启动我的应用程序时,它只显示
sany2k8@sany2k8-Aspire-4752:/var/projects/ENStack$ nodemon app.js
[nodemon] 1.9.2
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node app.js
[nodemon] clean exit - waiting for changes before restart
package.json
{
"name": "ENStack",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0"
}
}
编辑: 当我尝试使用 npm start
然后它显示了一堆错误
sany2k8@sany2k8-Aspire-4752:/var/projects/ENStack$ npm start
ENStack@0.0.0 start /var/projects/ENStack
node ./bin/www
端口 3000 已被使用
我们需要添加 start 和 nodemon ./bin/www 在 json 文件和
运行 您的项目使用:nodemon app
{
"name": "ENStack",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "nodemon ./bin/www"
},
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0"
}
}
此外,有时端口正在使用中。如果上述解决方案不适合您,请尝试更改端口。它可能正在用于其他一些节点实例。
这个问题一定有一些简单的解决方法。我已经使用 Webstorm 为 Express js + Node js 创建了一个新项目。然后我使用 npm install -g nodemon
安装了 nodemon 并且没问题。但是当我尝试使用 nodemon app.js
启动我的应用程序时,它只显示
sany2k8@sany2k8-Aspire-4752:/var/projects/ENStack$ nodemon app.js
[nodemon] 1.9.2
[nodemon] to restart at any time, enter
rs
[nodemon] watching: .[nodemon] starting
node app.js
[nodemon] clean exit - waiting for changes before restart
package.json
{
"name": "ENStack",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0"
}
}
编辑: 当我尝试使用 npm start
然后它显示了一堆错误
sany2k8@sany2k8-Aspire-4752:/var/projects/ENStack$ npm start
ENStack@0.0.0 start /var/projects/ENStack node ./bin/www
端口 3000 已被使用
我们需要添加 start 和 nodemon ./bin/www 在 json 文件和
运行 您的项目使用:nodemon app
{
"name": "ENStack",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "nodemon ./bin/www"
},
"dependencies": {
"body-parser": "~1.13.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jade": "~1.11.0",
"morgan": "~1.6.1",
"serve-favicon": "~2.3.0"
}
}
此外,有时端口正在使用中。如果上述解决方案不适合您,请尝试更改端口。它可能正在用于其他一些节点实例。