webpack-错误:找不到模块'webpack / lib / node / NodeTemplatePlugin'

时间:2018-11-23 21:46:38

标签: webpack

我提供--open服务时遇到此错误。我有最新的node / npm和angular-cli等。这是错误。

节点-v(v10.13.0)和npm(6.4.1)

如何解决此问题?

ERROR in ./src/main.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\mic\angular\test7\node_modules\@ngtools\webpack\src\resource_loader.js:16:28)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)

at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\mic\angular\test7\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:23:27)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
ERROR in ./src/polyfills.ts
Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\mic\angular\test7\node_modules\@ngtools\webpack\src\resource_loader.js:16:28)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\mic\angular\test7\node_modules\@ngtools   \webpack\src\angular_compiler_plugin.js:23:27)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)

1 个答案:

答案 0 :(得分:-1)

我想我遇到了同样的问题,并通过以下方法解决了这个问题:

  1. 首先键入以下内容:

    getBankAccounts
  2. 然后输入:

    async getBankAccounts(): GetBankAccountsResponseOrUserInputRequest {
        if (shouldGetUserInputRequest()) {
          return {
            __typename: "UserInputRequest",
            ...response,
          };
        }
    
        return {
          __typename: "GetAccountsResponse",
          accounts,
        };
      }
    
  3. 最后:

    npm i webpack -g