Angular CLI停止工作 - 意外令牌{

jhe*_*rtz 6 build npm angular

我使用Angular CLI创建项目一段时间,它工作正常.但是当我今天尝试创建一个新项目时,我在尝试提供它时遇到了错误.

ng serve
Unexpected token {
SyntaxError: Unexpected token {
   at exports.runInThisContext (vm.js:53:16)
   at Module._compile (module.js:373:25)
   at Object.Module._extensions..js (module.js:416:10)
   at Module.load (module.js:343:32)
   at Function.Module._load (module.js:300:12)
   at Module.require (module.js:353:17)
   at require (internal/module.js:12:17)
   ...
Run Code Online (Sandbox Code Playgroud)

这是完整的堆栈跟踪http://pastebin.com/71qU3G64

如果我删除node_modules目录并从旧项目中复制它可以工作,但这不是一个长期的解决方案.

jhe*_*rtz 8

现在正在努力

为了让我的旧项目在这些更改后工作,我必须执行以下操作(其中一些步骤来自上面的链接).

此更新适用于我的大多数项目,但我仍有一个问题

ng serve
  patterns.map is not a function
  TypeError: patterns.map is not a function
  at GlobCopyWebpackPlugin.apply (C:\Users\jhertz\Workspaces\eclipsekatujo\ibi\src\app\node_modules\@angular\cli\plugins\glob-copy-webpack-plugin.js:25:29)
  at Compiler.apply (C:\Users\jhertz\Workspaces\eclipsekatujo\ibi\src\app\node_modules\tapable\lib\Tapable.js:306:16)
  at webpack (C:\Users\jhertz\Workspaces\eclipse-katujo\ibi\src\app\node_modules\webpack\lib\webpack.js:32:19)
  at Class.run (C:\Users\jhertz\Workspaces\eclipse-katujo\ibi\src\app\node_modules\@angular\cli\tasks\serve.js:63:27)
  at checkExpressPort.then.then (C:\Users\jhertz\Workspaces\eclipse-katujo\ibi\src\app\node_modules\@angular\cli\commands\serve.js:84:26)
  at process._tickCallback (internal/process/next_tick.js:103:7)
Run Code Online (Sandbox Code Playgroud)

通过更新项目文件夹中的angular-cli.json解决了上述错误.

== Old ==
"assets": "assets",
== New ==
"assets": ["assets"]
Run Code Online (Sandbox Code Playgroud)