• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    미해결

npx webpack 오류

22.09.06 11:41 작성 조회수 653

0

npx webpack 명령어를 쳤더니

 

$ npx webpack

[webpack-cli] Failed to load 'C:\Users\ws\Desktop\sleact\alecture\webpack.config.ts' config

[webpack-cli] Error: Debug Failure. False expression: Non-string value passed to ts.resolveTypeReferenceDirective, likely by a wrapping package working with an outdated resolveTypeReferenceDirectives signature. This is probably not a problem in TS itself.

at Object.resolveTypeReferenceDirective (C:\Users\ws\Desktop\sleact\alecture\node_modules\typescript\lib\typescript.js:43192:18)

at C:\Users\ws\Desktop\sleact\alecture\node_modules\ts-node\src\index.ts:623:55

at Array.map (<anonymous>)

at Object.resolveTypeReferenceDirectives (C:\Users\ws\Desktop\sleact\alecture\node_modules\ts-node\src\index.ts:622:33)

at actualResolveTypeReferenceDirectiveNamesWorker (C:\Users\ws\Desktop\sleact\alecture\node_modules\typescript\lib\typescript.js:118205:163)

at resolveTypeReferenceDirectiveNamesWorker (C:\Users\ws\Desktop\sleact\alecture\node_modules\typescript\lib\typescript.js:118505:26)

at processTypeReferenceDirectives (C:\Users\ws\Desktop\sleact\alecture\node_modules\typescript\lib\typescript.js:120002:31)

at findSourceFileWorker (C:\Users\ws\Desktop\sleact\alecture\node_modules\typescript\lib\typescript.js:119887:21)

at findSourceFile (C:\Users\ws\Desktop\sleact\alecture\node_modules\typescript\lib\typescript.js:119739:26)

at C:\Users\ws\Desktop\sleact\alecture\node_modules\typescript\lib\typescript.js:119688:85

 

이런 오류가 나오는데요.. 오류 해결법을 몰라서 깃허브에 있는 코드를 복사 붙여넣기 했는데도 오류가 뜹니다. ㅠㅠ

답변 1

답변을 작성해보세요.

0

npm i typescript@latest ts-node@latest 해보세요.

wsws님의 프로필

wsws

질문자

2022.09.06

강의 처음부터 다시 듣고 하고있는데요 이젠 이렇게 뜹니다.

$ npm run build

npm ERR! code ENOENT

npm ERR! syscall open

npm ERR! path C:\Users\ws\Desktop\sleact\alecture/package.json

npm ERR! errno -4058

npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\ws\Desktop\sleact\alecture\package.json'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR! C:\Users\ws\AppData\Local\npm-cache\_logs\2022-09-06T03_35_49_104Z-debug-0.log

alecture 폴더 안에 package.json이 있는 게 맞으시죠? package.json 앞에만 경로가 /로 되어있네요. 다른데는 전부 \인데 말이죠.

tsconfig.json에 compilerOptions 아래에 다음 코드 추가하시고

"compilerOptions": {...},
"ts-node": {
  "compilerOptions": {
    "module": "commonjs",
    "moduleResolution": "Node",
    "target": "es5",
    "esModuleInterop": true
  }
}

package.json에서 scripts -> build는 "cross-env NODE_ENV=production webpack"로 하신 후

npm run build 해보세요.

wsws님의 프로필

wsws

질문자

2022.09.06

"compilerOptions": {...}, 에서  {...},분에 빨간줄이 그어지면서 

Property keys must be doublequoted 오류가 나옵니다

{...}를 그대로 쓰셨나요? 제 강좌에 있는 부분을 넣으라고 적은 부분입니다.

잠깐 봤는데 node_modules 폴더 안에 package.json이 있으면 안 되고, node_modules랑 같은 위치에 package.json이 있어야 합니다.