2017-02-23 19 views
15

私のワークステーションから私の家庭のPCにプロジェクトを移動しましたが、今はもうコンパイルできません。ローカルおよびグローバル活字体を設置、コンパイル時にTypescript loaderが複数の 'Duplicate identifier ..'エラーを投げます

私が削除した
TS2300: Duplicate identifier 'Request'. 

ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:9360:13 
    TS2300: Duplicate identifier 'Request'. 

ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:9365:11 
    TS2300: Duplicate identifier 'Response'. 

ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:9376:13 
    TS2300: Duplicate identifier 'Response'. 

ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:14893:18 
    TS2451: Cannot redeclare block-scoped variable 'fetch'. 

ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:14898:6 
    TS2300: Duplicate identifier 'BodyInit'. 

ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:14919:6 
    TS2300: Duplicate identifier 'HeadersInit'. 

ERROR in [at-loader] C:\Users\Rat King Cole\AppData\Roaming\npm\node_modules\typescript\lib\lib.dom.d.ts:14929:6 
    TS2300: Duplicate identifier 'RequestInfo'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:11:13 
    TS2451: Cannot redeclare block-scoped variable 'fetch'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:13:14 
    TS2300: Duplicate identifier 'HeadersInit'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:14:15 
    TS2300: Duplicate identifier 'Headers'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:31:14 
    TS2300: Duplicate identifier 'BodyInit'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:43:14 
    TS2300: Duplicate identifier 'RequestInfo'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:44:15 
    TS2300: Duplicate identifier 'Request'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:64:11 
    TS2300: Duplicate identifier 'Request'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:70:5 
    TS2403: Subsequent variable declarations must have the same type. Variable 'referrerPolicy' must be of type 'string', but here has type 'ReferrerPolicy'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:71:5 
    TS2403: Subsequent variable declarations must have the same type. Variable 'mode' must be of type 'string', but here has type 'RequestMode'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:72:5 
    TS2403: Subsequent variable declarations must have the same type. Variable 'credentials' must be of type 'string', but here has type 'RequestCredentials'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:73:5 
    TS2403: Subsequent variable declarations must have the same type. Variable 'cache' must be of type 'string', but here has type 'RequestCache'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:74:5 
    TS2403: Subsequent variable declarations must have the same type. Variable 'redirect' must be of type 'string', but here has type 'RequestRedirect'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:76:5 
    TS2403: Subsequent variable declarations must have the same type. Variable 'window' must be of type 'any', but here has type 'null'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:88:15 
    TS2300: Duplicate identifier 'Response'. 

ERROR in [at-loader] node_modules\@types\whatwg-fetch\index.d.ts:107:11 
    TS2300: Duplicate identifier 'Response'. 

ERROR in [at-loader] node_modules\@types\whatwg-streams\index.d.ts:32:15 
    TS2300: Duplicate identifier 'ReadableStream'. 

、再インストールされているすべてのnode_modules(およびタイプ)しようとした:私は「WebPACKの」を実行しているときはいつでも

、私は次のエラーを取得していますts-loaderからawesome-typescript-loaderに切り替えました(少なくとも私が持っていたいくつかのエラーを解決しました)。

tsconfig.json

{ 
    "compilerOptions": { 
     "baseUrl": "app", 
     "moduleResolution": "node", 
     "module": "commonjs", 
     "target": "es6", 
     "jsx": "preserve", 
     "noImplicitAny": false, 
     "sourceMap": true, 
     "lib": [ 
      "es6", 
      "dom" 
     ], 
     "emitDecoratorMetadata": true, 
     "experimentalDecorators": true 
    }, 
    "exclude": [ 
     "node_modules" 
    ] 
} 

webpack.config.js残念ながら、私は非常にこの分野で経験していないよ

var webpack = require('webpack'); 
var HtmlWebpackPlugin = require('html-webpack-plugin'); 
const { CheckerPlugin } = require('awesome-typescript-loader') 
var TsConfigPathsPlugin = require('awesome-typescript-loader').TsConfigPathsPlugin; 

module.exports = { 
    entry: { 
     'vendor': [ 
      'react', 
      'react-dom', 
      'react-router', 
      'react-bootstrap', 
      'react-router-bootstrap', 
      'react-datetime' 
     ], 
     'client': [ 
      'webpack-dev-server/client?http://0.0.0.0:8080', // WebpackDevServer host and port 
      'webpack/hot/only-dev-server', // "only" prevents reload on syntax errors 
      './app/boot-client.tsx' 
     ], 
    }, 
    output: { 
     filename: '[name].bundle.js', 
     path: './app/', 
    }, 
    resolve: { 
     plugins: [ 
      new TsConfigPathsPlugin('./tsconfig.json') 
     ], 
     extensions: ['.js', '.jsx', '.ts', '.tsx', '.scss'] 
    }, 
    module: { 
     loaders: [ 
      { 
       test: /\.tsx?$/, 
       include: /app/, 
       loaders: 'babel-loader', 
       query: { 
        presets: ['es2015'] 
       } 
      }, 
      { 
       test: /\.tsx?$/, 
       include: /app/, 
       loaders: 'awesome-typescript-loader' 
      }, 
      { 
       test: /\.scss$/, 
       loaders: ['style-loader', 'css-loader', 'sass-loader'] 
      } 
     ] 
    }, 
    plugins: [ 
     new webpack.optimize.CommonsChunkPlugin('vendor'), 
     new HtmlWebpackPlugin({ 
      inject: 'body', 
      template: 'app/index_template.html', 
      filename: 'index.html' 
     }), 
     new webpack.HotModuleReplacementPlugin(), 
     new CheckerPlugin() 
    ], 
    devServer: { 
     contentBase: "./app", 
     port: 8080 
    }, 
}; 

は、私はここで何をしないのですか?

答えて

30

ERROR node_modules \ @types \ \ index.d.ts WHATWGフェッチ[AT-ローダー]で:11:箱から出して定義をフェッチして13

活字最新の船を。したがって、whatwg-fetchの定義をアンインストールします。

npm uninstall @types/whatwg-fetch 
関連する問題