Webpack重复标识符'PropertyKey'

时间:2016-11-21 23:57:24

标签: angular webpack .net-core webpack-dev-server

尝试使用VS2015部署我的角度2应用程序时。在运行webpack时有两个错误,但在vs2015中进行构建时没有错误

C:\Users\asus\Desktop\C# Web\Core\AngularAPI\ApiAngWebPack\WebApp> cmd /c SET NODE_ENV=development&& webpack -d --color
@@@@@@@@@ USING DEVELOPMENT @@@@@@@@@@@@@@@
clean-webpack-plugin: C:\Users\asus\Desktop\C# Web\Core\AngularAPI\ApiAngWebPack\WebApp\wwwroot\dist has been removed.
clean-webpack-plugin: C:\Users\asus\Desktop\C# Web\Core\AngularAPI\ApiAngWebPack\WebApp\wwwroot\fonts has been removed.
clean-webpack-plugin: C:\Users\asus\Desktop\C# Web\Core\AngularAPI\ApiAngWebPack\WebApp\wwwroot\assets has been removed.
Hash: ab986b13a96ef5707853
Version: webpack 2.1.0-beta.25
Time: 18114ms
                                           Asset       Size  Chunks             Chunk Names
  assets/glyphicons-halflings-regular-f4769f.eot    20.1 kB          [emitted]  
  assets/glyphicons-halflings-regular-f72146.svg     109 kB          [emitted]  
  assets/glyphicons-halflings-regular-e18bbf.ttf    45.4 kB          [emitted]  
 assets/glyphicons-halflings-regular-fa2772.woff    23.4 kB          [emitted]  
assets/glyphicons-halflings-regular-448c34.woff2      18 kB          [emitted]  
                              dist/app.bundle.js     8.8 MB       0  [emitted]  app
                                      index.html  426 bytes          [emitted]  
                            assets/damienbod.jpg    4.85 kB          [emitted]  
    + 805 hidden modules
ERROR in [default] C:\Users\asus\Desktop\C# Web\Core\AngularAPI\ApiAngWebPack\WebApp\node_modules\typescript\lib\lib.es2015.core.d.ts:17:13 
Duplicate identifier 'PropertyKey'.
ERROR in [default] C:\Users\asus\Desktop\C# Web\Core\AngularAPI\ApiAngWebPack\node_modules\@types\core-js\index.d.ts:21:13 
Duplicate identifier 'PropertyKey'.
Child html-webpack-plugin for "index.html":
        + 1 hidden modules
Process terminated with code 2.

此问题不允许生成新版本。这是浏览器显示的结果

Uncaught Error: Module build failed: Error: EPERM: operation not permitted, open 'C:\Users\asus\Desktop\C# Web\Core\AngularAPI\ApiAngWebPack\WebApi\node_modules\webpack\buildin\global.js'
    at Error (native)
    at Error (native)
    at eval (eval at <anonymous> (http://localhost:18678/dist/app.bundle.js:530:1), <anonymous>:1:7)
    at Object.<anonymous> (http://localhost:18678/dist/app.bundle.js:530:1)
    at __webpack_require__ (http://localhost:18678/dist/app.bundle.js:20:30)
    at eval (eval at <anonymous> (http://localhost:18678/dist/app.bundle.js:7659:1), <anonymous>:182:44)
    at Object.<anonymous> (http://localhost:18678/dist/app.bundle.js:7659:1)
    at __webpack_require__ (http://localhost:18678/dist/app.bundle.js:20:30)
    at Object.eval (eval at <anonymous> (http://localhost:18678/dist/app.bundle.js:4799:1), <anonymous>:1:113)
    at eval (eval at <anonymous> (http://localhost:18678/dist/app.bundle.js:4799:1), <anonymous>:71:30)
    at Object.<anonymous> (http://localhost:18678/dist/app.bundle.js:4799:1)
    at __webpack_require__ (http://localhost:18678/dist/app.bundle.js:20:30)

在解决方案资源管理器中检查,node_modules / webpack中没有此类buildin / global文件夹。不确定它是一个错误的总和还是只是一个。我不认为webpack在node_modules文件夹@ vs2015中创建了建筑物。

修改

添加package.json

"webpack": "2.1.0-beta.27",
"webpack-dev-server": "^1.16.2"

发现了与vs2015相关的一些问题,但就我而言,vs2015方面没有问题similar SO question

1 个答案:

答案 0 :(得分:0)

更新Typescript和webpack服务器版本并停止使用@types \ core-js来设置tsconfig.json中的lib,根据此答案解决问题GitHub question

"compilerOptions": {
    "target": "es6",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": true,
    "noImplicitAny": true,
    "skipLibCheck": true,
    "lib": [
      "es6",
      "dom"
    ],
    "types": [
      "node"
    ]
  },