Node.js Nodemon错误事件。js:182?
当我试图通过nodemon通过键入Node.js Nodemon错误事件。js:182?,node.js,nodemon,Node.js,Nodemon,当我试图通过nodemon通过键入nodemon app.js或只是nodemon启动app.js时 然后,我的终端出现以下错误: 我的app.js文件是: var express = require("express")(); express.get("/", function(req, res) { res.render("home.ejs"); }); express.get("/fallinlovewith/:thing", function(req, res) { var
nodemon app.js
或只是nodemon
启动app.js时
然后,我的终端出现以下错误:
我的app.js文件是:
var express = require("express")();
express.get("/", function(req, res) {
res.render("home.ejs");
});
express.get("/fallinlovewith/:thing", function(req, res) {
var thing = req.params.thing;
res.render("love.ejs", {thingVar: thing});
});
express.get("/posts", function(req, res) {
var posts = [
{title: "Post is cool", author: "Susy"},
{title: "My adorable pet Poem", author: "Akash"},
{title: "I have a cat", author: "Colt"}
];
res.render("posts.ejs", {posts: posts});
});
express.listen(process.env.PORT || 3000, function() {
console.log("Server is listening at port 3000! ;-)");
});
my package.json是:
{
"name": "esjdemo",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Akash Soedamah",
"license": "ISC",
"dependencies": {
"ejs": "^2.5.7",
"express": "^4.16.2",
"nodemon": "^1.12.1"
}
}
我已经解决了这个问题。。我必须将c:\windows\system32添加到我的环境变量(PATH)!挣扎着,但最终得到了答案
{
"name": "esjdemo",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Akash Soedamah",
"license": "ISC",
"dependencies": {
"ejs": "^2.5.7",
"express": "^4.16.2",
"nodemon": "^1.12.1"
}
}