2017-12-10 22 views
0

나는 webpack을 사용하여 빌드하려고하는 다음 타이프 스크립트 파일이 있습니다. 내가 처음 웹팩을 실행하면, 오류가 발생했습니다 : ncpm과 연결 타이프 렛은 어떤 의미입니까?

08/12/2017 17:18    39 a.ts 
08/12/2017 17:18    39 b.ts 
10/12/2017 10:03 <DIR>   node_modules 
08/12/2017 17:15    160 test.ts 
09/12/2017 19:42    317 tsconfig.json 
10/12/2017 10:15    212 webpack.config.js 

C:\Users\Manu\Documents\manu\programs\typescript>webpack 
Hash: ca89239394c5fd4255d7 
Version: webpack 3.3.0 
Time: 281ms 
     Asset  Size Chunks    Chunk Names 
./bundle.js 2.73 kB  0 [emitted] main 
    [0] ./test.ts 254 bytes {0} [built] [failed] [1 error] 

ERROR in ./test.ts 
Module build failed: Could not load TypeScript. Try installing with `yarn add typescript` or `npm install typescript`. If TypeScript is installed globally, try using `yarn link typescript` or `npm link typescript`. 

C:\Users\Manu\Documents\manu\programs\typescript>npm link typescript 
C:\Users\Manu\Documents\manu\programs\typescript\node_modules\typescript -> 
C:\Users\Manu\AppData\Roaming\npm\node_modules\typescript 

C:\Users\Manu\Documents\manu\programs\typescript>webpack 
Hash: 81b7d03586b8d82eefd3 
Version: webpack 3.3.0 
Time: 2375ms 
     Asset  Size Chunks    Chunk Names 
./bundle.js 2.66 kB  0 [emitted] main 
    [0] ./test.ts 187 bytes {0} [built] 

은 내가 npm link typescript 명령을 실행하고 일이했다. 그러나 링크 명령을 실행해야하는 이유를 이해할 수 없습니까? (또는 당신의 시스템에 누군가가) npm install typescript -g 같은 것을 실행 즉, 타이프 라이터가 전 세계적으로

설치되어 있기 때문에

+0

이 문제는 멀리 갔다하지만 어쩌면 링크는 같은 일을합니까? – Kokodoko

답변

0

I executed the npm link typescript command and things worked. However, I do not understand why I had to run the link command

그 일했다.

문서 : 나는 두 세계와 및 localY 타이프 라이터를 설치할 때 내 경우 https://docs.npmjs.com/cli/link