Angular 通用安装抛出错误

Angular universal installation throws error

当我尝试使用以下命令安装 Angular Universal 时,出现错误:

使用的命令:

     ng add @ng-toolkit/universal

错误:

       Invalid regular expression flags
         C:\Users\nnnn\Downloads\ccc\ngseo\node_modules\@ng- 
         toolkit\universal\schematics.js:199
        tree.overwrite(`/${options.serverFileName}`, 
        test_1.getFileContent(tree, 
        `/${options.serverFileName}`).replace(/\/\/ Start up the Node 
        server.*/gs, '').replace('const app = express();', 'export const 
        app = express();'));

        ^

   SyntaxError: Invalid regular expression flags
   at createScript (vm.js:80:10)
   at Object.runInThisContext (vm.js:139:10)
   at Module._compile (module.js:599:28)
   at Object.Module._extensions..js (module.js:646:10)
   at Module.load (module.js:554:32)
   at tryModuleLoad (module.js:497:12)
   at Function.Module._load (module.js:489:3)
   at Module.require (module.js:579:17)
   at require (internal/module.js:11:18)
   at new ExportStringRef 
   (C:\Users\nnnn\Downloads\ccc\ngseo\node_modules\@angular- 
   devkit\schematics\tools\export-ref.js:18:25)
   at NodeModulesEngineHost._resolveReferenceString 
  (C:\Users\nnnn\Downloads\ccc\ngseo\node_modules\@angular- 
  devkit\schematics\tools\node-module-engine-host.js:94:21)
   at NodeModulesEngineHost.createSchematicDescription 
   (C:\Users\nnnn\Downloads\ccc\ngseo\node_modules\@angular- 
   devkit\schematics\tools\file-system-engine-host-base.js:172:34)
   at SchematicEngine.createSchematic 
   (C:\Users\nnnn\Downloads\ccc\ngseo\node_modules\@angular- 
   devkit\schematics\src\engine\engine.js:219:38)
    at CollectionImpl.createSchematic 
  (C:\Users\nnnn\Downloads\ccc\ngseo\node_modules\@angular- 
  devkit\schematics\src\engine\engine.js:69:29)
   at AddCommand.getSchematic 

(C:\Users\nnnn\Downloads\ccc\ngseo\node_modules@angular\cli\models\schematic-command.js:130:27) 在 AddCommand.runSchematic (C:\Users\nnnn\Downloads\ccc\ngseo\node_modules@angular\cli\models\schematic-command.js:262:32)

你知道如何解决这个问题吗?

这是图书馆的一个已知问题。

https://github.com/maciejtreder/ng-toolkit/issues/590

你必须 运行 支持 JavaScript ES2018 的 NodeJS 版本。

http://2ality.com/2017/07/regexp-dotall-flag.html

将您的 NodeJS 升级到最新的 LTS 版本。

https://nodejs.org/en/