• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    해결됨

npm run dev 살행 시 오류 발생

24.01.09 11:48 작성 조회수 246

1

VS Code 터미널에서
- npm install 실행하고
- npm run dev 를 실행하면 아래 오류가 발생합니다.
** 오류가 발생하여 vs code를 삭제 후 재설치하여 다시 해봐도 동일 오류가 발생합니다.


PS D:\vuejs_workspace\Projects\learn-vue3> npm run dev

> learn-vue3@0.0.0 dev D:\vuejs_workspace\Projects\learn-vue3

> vite

(node:2112) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token '??='

at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18)

(Use node --trace-warnings ... to show where the warning was created)

(node:2112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:2112) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

PS D:\vuejs_workspace\Projects\learn-vue3>

---npm 버전 정보는 아래와 같습니다.

PS D:\vuejs_workspace\Projects\learn-vue3> npm version

{

'learn-vue3': '0.0.0',

npm: '6.14.15',

ares: '1.17.2',

brotli: '1.0.9',

cldr: '39.0',

icu: '69.1',

llhttp: '2.1.3',

modules: '83',

napi: '8',

nghttp2: '1.42.0',

node: '14.17.6',

openssl: '1.1.1l',

tz: '2021a',

unicode: '13.0',

uv: '1.41.0',

v8: '8.4.371.23-node.76',

zlib: '1.2.11'

}

답변 2

·

답변을 작성해보세요.

1

taeyoul.im님의 프로필

taeyoul.im

2024.01.09

Node.js 버전이 낮아 발생한 것 같습니다.
Node.js 버전을 최신버전으로 재 설치하고 진행하니 정상 작동합니다.

1

안녕하세요 🙂

SyntaxError: Unexpected token '??='는 해당 코드를 해석하지 못했는데요.

🤔 ?? 해당 연산자는 nodejs 14이상에서 지원하지만

vite 실행 환경에서 다를 수 있고 현재 nodejs 버전이 낮은 것 같아서요.

nodejs 를 업그레이드 하고 다시 진행해 보시겠어요?

 

참고로 제 버전은

{
  npm: '10.1.0',
  node: '20.9.0'
}