Solvedangular cli patterns.map is not a function

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows 10

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

$ ng --version
angular-cli: local (v1.0.0-beta.22-1, branch: master)
node: 6.9.2
os: win32 x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

This app is working fine on 1.0.0-beta.21. On the latest master branch I get this error.

The log given by the failure.

Normally this include a stack trace and some more information.

$ ng serve
patterns.map is not a function
TypeError: patterns.map is not a function
    at GlobCopyWebpackPlugin.apply (C:\projects\git\angular-cli\packages\angular-cli\plugins\glob-copy-webpack-plugin.ts:16:29)
    at Compiler.apply (C:\projects\git\angular-cli\node_modules\tapable\lib\Tapable.js:270:16)
    at WebpackOptionsApply.process (C:\projects\git\angular-cli\node_modules\webpack\lib\WebpackOptionsApply.js:59:18)
    at webpack (C:\projects\git\angular-cli\node_modules\webpack\lib\webpack.js:28:48)
    at Class.run (C:\projects\git\angular-cli\packages\angular-cli\tasks\serve-webpack.ts:38:27)
    at C:\projects\git\angular-cli\packages\angular-cli\commands\serve.ts:105:26
    at process._tickCallback (internal/process/next_tick.js:103:7)
14 Answers

✔️Accepted Answer

I have same issue. Finally, It looks like caused by a scheme changing.

image

The item "assets" now is an array.

image

I set the value from "assets": "assets" to "assets": ["assets"] in angular-cli.json, and the error was gone.

Other Answers:

although issue has been closed... I had same exception when moving from beta.22-1 to beta.24; I changed "assets" parameter in angular-cli.json.

  • not working: "assets: "assets"
  • working: "assets: [ "assets" ]

This parameter must be an array.

Yup still have the same problem. I migrated from 1.0.0 beta 17 to 1.0.0 beta 30 and loicsalou solution worked for me.
"assets: [ "assets" ] solves the problem.

More Issues: