0
nodemon app.js
と入力するか、nodemon
と入力して、app.jsをnodemon経由で起動しようとします。Nodemonエラーevents.js:182?
私はその後、私のターミナルで次のエラーが表示されます。 https://i.stack.imgur.com/1UYK4.png
PS C:\Users\ered0c\Coding\NodeJs\ESJDemo> nodemon app.js
[nodemon] 1.12.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`
events.js:182
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at _errnoException (util.js:1024:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
at onErrorNT (internal/child_process.js:374:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
私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! ;-)");
});
私の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"
}
}