【问题标题】:Webpack Duplicate identifier 'PropertyKey'Webpack重复标识符'PropertyKey'
【发布时间】:2016-11-21 23:57:24
【问题描述】:

尝试使用 VS2015 部署我的 Angular 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

【问题讨论】:

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


    【解决方案1】:

    更新 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"
        ]
      },
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-13
      • 2017-02-19
      • 2019-02-23
      • 1970-01-01
      • 1970-01-01
      • 2012-07-20
      • 2019-12-11
      相关资源
      最近更新 更多