当npm启动时,ASP.NET Boilerplate Angular Project出错

时间:2017-10-09 08:54:38

标签: angularjs npm asp.net-core aspnetboilerplate

我使用基于.Net CoreAngular的{​​{3}}。我一步一步地遵循ASP.NET Boilerplate Framework中的指令,但是当我运行npm start时,我收到以下错误消息:

ERROR in ./src/polyfills.ts
Module not found: Error: Can't resolve 'web-animations-js' in'D:\Project_Net\MyProjSPA\angular\src'
resolve 'web-animations-js' in 'D:\Project_Net\MyProjSPA\angular\src'
  Parsed request is a module
  using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./src)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./src)
    resolve as module
      D:\Project_Net\MyProjSPA\angular\src\node_modules doesn't exist or is not a directory
      D:\Project_Net\MyProjSPA\node_modules doesn't exist or is not a directory
      D:\Project_Net\node_modules doesn't exist or is not a directory
      looking for modules in D:\Project_Net\MyProjSPA\angular\node_modules
        using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./node_modules)
          using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./node_modules/web-animations-js)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js.js doesn't exist
            as directory
              D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js doesn't exist
      looking for modules in D:\node_modules
        No description file found
        Field 'browser' doesn't contain a valid alias configuration
        No description file found
        no extension
          Field 'browser' doesn't contain a valid alias configuration
          D:\node_modules\web-animations-js doesn't exist
        .ts
          Field 'browser' doesn't contain a valid alias configuration
          D:\node_modules\web-animations-js.ts doesn't exist
        .js
          Field 'browser' doesn't contain a valid alias configuration
          D:\node_modules\web-animations-js.js doesn't exist
        as directory
          D:\node_modules\web-animations-js doesn't exist
      looking for modules in D:\Project_Net\MyProjSPA\angular\node_modules
        using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./node_modules)
          using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./node_modules/web-animations-js)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js.js doesn't exist
            as directory
              D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js doesn't exist
      looking for modules in D:\Project_Net\MyProjSPA\angular\src
        using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./src)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./src)
          using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./src/web-animations-js)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\src\web-animations-js doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\src\web-animations-js.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\src\web-animations-js.js doesn't exist
            as directory
              D:\Project_Net\MyProjSPA\angular\src\web-animations-js doesn't exist
      looking for modules in D:\Project_Net\MyProjSPA\angular\src
        using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./src)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./src)
          using description file: D:\Project_Net\MyProjSPA\angular\package.json (relative path: ./src/web-animations-js)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\src\web-animations-js doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\src\web-animations-js.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\Project_Net\MyProjSPA\angular\src\web-animations-js.js doesn't exist
            as directory
              D:\Project_Net\MyProjSPA\angular\src\web-animations-js doesn't exist
[D:\Project_Net\MyProjSPA\angular\src\node_modules]
[D:\Project_Net\MyProjSPA\node_modules]
[D:\Project_Net\node_modules]
[D:\node_modules\package.json]
[D:\node_modules\web-animations-js\package.json]
[D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js]
[D:\node_modules\web-animations-js]
[D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js.ts]
[D:\node_modules\web-animations-js.ts]
[D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js.js]
[D:\node_modules\web-animations-js.js]
[D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js]
[D:\node_modules\web-animations-js]
[D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js]
[D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js.ts]
[D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js.js]
[D:\Project_Net\MyProjSPA\angular\node_modules\web-animations-js]
[D:\Project_Net\MyProjSPA\angular\src\web-animations-js]
[D:\Project_Net\MyProjSPA\angular\src\web-animations-js.ts]
[D:\Project_Net\MyProjSPA\angular\src\web-animations-js.js]
[D:\Project_Net\MyProjSPA\angular\src\web-animations-js]
[D:\Project_Net\MyProjSPA\angular\src\web-animations-js]
[D:\Project_Net\MyProjSPA\angular\src\web-animations-js.ts]
[D:\Project_Net\MyProjSPA\angular\src\web-animations-js.js]
[D:\Project_Net\MyProjSPA\angular\src\web-animations-js]
 @ ./src/polyfills.ts 36:0-27
 @ multi ./src/polyfills.ts

以下是我的框架版本:

npm -v // 3.10.10
node -v // 6.11.3
tsc -v //2.5.3
ng -v // @angular/core 4.4.4
angular-cli version in `package.json` : //@angular/cli": "^1.3.2"

我认为它与角版或打字版有关。我是对的吗? 我该怎么做才能解决这个问题?

2 个答案:

答案 0 :(得分:2)

angular/package.json

中添加此内容
"web-animations-js": "^2.3.1"

angular/src/polyfills.ts

取消注释
import 'web-animations-js';

答案 1 :(得分:1)