• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

backend 쪽의 nodemon scripts

20.04.07 23:00 작성 조회수 1.56k

5

backend 쪽의 nodemon scripts를 어떻게 변경해 줘야 되나요?

nodemon이 경로를 찾지 못하는것 같아요~

[nodemon] 2.0.2

[nodemon] to restart at any time, enter `rs`

[nodemon] watching dir(s): *.*

[nodemon] watching extensions: js,mjs,json

[nodemon] starting `node index.js index.js`

internal/modules/cjs/loader.js:796

    throw err;

    ^

Error: Cannot find module 'C:\Users\patmo\Documents\myProject\inf-todo\index.js'

    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)

    at Function.Module._load (internal/modules/cjs/loader.js:686:27)

    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)

    at internal/main/run_main_module.js:17:11

{

  code: 'MODULE_NOT_FOUND',

  requireStack: []

}

[nodemon] app crashed - waiting for file changes before starting...

이런 에러가 뜨네요~ 

server 경로로 가서 node index.js 하면 돌아가는데

이상하네요~

https://github.com/ryun3433/inf-todo.git

(config 폴더 대신해서 .env 사용했습니다)

깃헙 주소도 남깁니다~

답변 2

·

답변을 작성해보세요.

19

안녕하세요 ^^ 

현재 보면   package.json은  root 디렉토리에 있고 

index.js 는  server 폴더 안에 있잔아요 

그래서 

"backend": "nodemon index.js",

위에것에서 아래것으로 바꿔주세요 ^^ 

"backend": "nodemon server/index.js",

이렇게 해주셔야 합니다 ^^

0

김관김관님의 프로필

김관김관

2020.05.06

감사합니다