본문 바로가기

Node.js

누락된 스크립트 오류

express: https://expressjs.com/en/starter/hello-world.html

 

Express "Hello World" example

Hello world example Embedded below is essentially the simplest Express app you can create. It is a single file app — not what you’d get if you use the Express generator, which creates the scaffolding for a full app with numerous JavaScript files, Jade

expressjs.com

index.js express모듈 복붙(->가져온다)

오류1

npm ERR! Missing script: "start"
npm ERR!
npm ERR! Did you mean one of these?
npm ERR!     npm star # Mark your favorite packages
npm ERR!     npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

누락된 스크립트 오류라고 생각하고 검색->https://bobbyhadz.com/blog/npm-missing-script-start 사이트를 참고

먼저 스크립트 오타를 확인했고 혹시? 저장인가 해봤는데 성공

 

오류2

app.listen(port, () => {
  console.log(`Example app listening on port ${port}`)
})
 
로그 창 해당 성공포트가 안 나왔다.
이것도 저장 문제였다.->vscode->파일-> 자동저장
 
 
 
 

궁금증1

강의와 다르게 package-lock.json이 있는데 이건 뭘까

https://hyunjun19.github.io/2018/03/23/package-lock-why-need/ 사이트로 해결