angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng add @angular/material

Open kamalkech opened this issue 8 years ago • 18 comments

Angular CLI: 6.0.0-rc.5 Node: 8.11.0 OS: darwin x64 Angular: 6.0.0-rc.5

when try to add angular material with commande : ng add @angular/material

i get this error :

telechargement 1

any idea ?

kamalkech avatar Apr 18 '18 22:04 kamalkech

You need to install the packages first: npm install --save angular/material2-builds@next angular/cdk-builds@next then ng add @angular/material

mrmokwa avatar Apr 19 '18 16:04 mrmokwa

@MRMokwa thank you for but i get this error when try to install packages :

npm-install

kamalkech avatar Apr 19 '18 16:04 kamalkech

Do you mind trying a new project from zero?

ng n teste-app cd teste-app npm install --save @angular/material@next @angular/cdk@next ng add @angular/material

Result I expect: image

My versions: image

mrmokwa avatar Apr 19 '18 16:04 mrmokwa

@MRMokwa When I try doing that, I only get a "Cannot read property 'includes' of undefined" message.

image

My versions: image

Could the different node versions be the cause of this issue?

Edit: nevermind, the same happens after I updated to node 9.11.1

lehoffma avatar Apr 19 '18 17:04 lehoffma

Hi @MRMokwa, i follow your instructions and i creat another new app and this a result:

am

i guess my be need to update node version too ?

kamalkech avatar Apr 19 '18 17:04 kamalkech

I just downgraded my Node and it still working as expected for me.

image

Really weird issue, don't know what's causing it.

My full version if you want to compare: image

mrmokwa avatar Apr 19 '18 18:04 mrmokwa

I'm having the same issue.

Here is my full version screen shot 2018-04-19 at 12 23 36 pm

And when I run ng add @angular/material screen shot 2018-04-19 at 12 22 17 pm

Edit: also tested in Node 9.11.1 same result

cduran avatar Apr 19 '18 18:04 cduran

I'm getting the same issue. On a new project:

image

These are my versions:

image

FernandoGomez avatar Apr 20 '18 07:04 FernandoGomez

I've updated material and cdk to rc.12 and I'm now having the same issue as @cduran

FernandoGomez avatar Apr 20 '18 07:04 FernandoGomez

This should be managed by the material team as its part of their schematics; its not a CLI issue. I had already logged the issue at https://github.com/angular/material2/issues/10912. @kamalkech you might want to close this one.

tobi-or-not-tobi avatar Apr 20 '18 08:04 tobi-or-not-tobi

@tobi-or-not-tobi ok!

kamalkech avatar Apr 20 '18 08:04 kamalkech

@tobi-or-not-tobi fixed when you update angular cli to rc.7

kamalkech avatar Apr 28 '18 11:04 kamalkech

Thanks @kamalkech, I'm unfortunately blocked by #10513.

tobi-or-not-tobi avatar Apr 29 '18 10:04 tobi-or-not-tobi

@kamalkech But works fine when I update an existing project. Thanks for the heads-up.

tobi-or-not-tobi avatar Apr 29 '18 11:04 tobi-or-not-tobi

with cli6 this works:

ng new x cd x ng add @angular/material@^6.0.0

No docs on schematics tho as seen in ngconf :( (and even docs for ng add are missing from the cli wiki)

edit: https://github.com/angular/material2/blob/6.0.x/guides/schematics.md :)

NELBNL avatar May 04 '18 20:05 NELBNL

Worked by updating npm for me. npm version 6.1.0

Try running npm i -g npm

momegas avatar Jun 15 '18 08:06 momegas

When i do:

npm install --save @angular/material @angular/cdk

it installs below:

Then, as per above solutions:

I do:

ng add @angular/material

it throws as below:

Installing packages for tooling via npm. Cannot read property 'startTag' of undefined

NPM Version: 6.1.0 Angular CLI: 6.0.8 Node: 8.11.3 OS: darwin x64 Angular: 6.0.7

ghost avatar Jul 07 '18 13:07 ghost

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.