2017-11-04 15 views
0

nodemon app.js 또는 nodemon을 입력하여 nodemon을 통해 내 app.js를 시작하려고 할 때.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" 
    } 
} 

답변

1

나는이 문제를 해결했다. 나는 환경 변수 (PATH)에 c : \ windows \ system32를 추가해야했다. ! 그것으로 고생했지만 마침내 대답을 얻었습니다.