VS 터미널에서 해당 오류 발생
$ node app.js
node:internal/modules/cjs/loader:1078
throw err;
^
Error: Cannot find module 'express'
Require stack:
- C:\Users\user\Desktop\to-do\app.js
?[90m at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)?[39m
?[90m at Module._load (node:internal/modules/cjs/loader:920:27)?[39m
?[90m at Module.require (node:internal/modules/cjs/loader:1141:19)?[39m
?[90m at require (node:internal/modules/cjs/helpers:110:18)?[39m
at Object.<anonymous> ?[90m(C:\Users\user\Desktop\to-do\?[39mapp.js:1:17?[90m)?[39m
?[90m at Module._compile (node:internal/modules/cjs/loader:1254:14)?[39m
?[90m at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)?[39m
?[90m at Module.load (node:internal/modules/cjs/loader:1117:32)?[39m
?[90m at Module._load (node:internal/modules/cjs/loader:958:12)?[39m
?[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)?[39m {
code: ?[32m'MODULE_NOT_FOUND'?[39m,
requireStack: [ ?[32m'C:\\Users\\user\\Desktop\\to-do\\app.js'?[39m
]
}
Node.js v18.16.0
Error: Cannot find module 'express'
Require stack:
=> 'express'가 없다는 뜻
npm install
재시도node_modules
와 package-lock.json
파일을 지운뒤npm install
을 해도 오류 해결이 안 됨npm install express
재설치1.
express
재설치npm install express
2.
express
모듈이 이미 설치되어 있으면, 프로젝트의 '패키지'에 종속성으로 나열되어 있는지 확인npm install express --save