What is difference between the following commands that adds angular-material functionality to project? What command is better to use on production?
- meteor npm install angular-material --save
- meteor add angular:angular-material
What is difference between the following commands that adds angular-material functionality to project? What command is better to use on production?
The former is installing npm packages, which will be listed in packages.json and located in the node modules directory and need to be imported into your code.
The latter is using atmosphere packages which will be listed under .meteor/packages and will be included in your build (no need to import).
But why official Meteor Tutorials suggests to use former âmeteor npm installâ instead of latter âmeteor addâ? e.g.
https://www.meteor.com/tutorials/angular/templates
meteor npm install --save angular angular-meteor
http://www.angular-meteor.com/tutorials/socially/angular1/angular-material-and-custom-angular-auth-forms
meteor npm install angular-material --save
Above answer is correct, although if youâre using the new directory structure for Meteor 1.3 and placing your files in the âimportsâ directory you still need to import atmosphere packages in your files that use it. So if youâre using âMeteor.accountsâ for example, you need to import meteor.
Because the best practice is to use npm
and not Meteor specific package manager (unless itâs for build and then you have to use Atmosphere)
Hi Urigo. I had a couple of more questions: what do you mean by âfor buildâ? And is it okay to use yarn instead of npm? Thanks
âFor buildâ is referring to Meteor build plugins, which are primarily used for preprocessors - less, sass, typescript, coffescript, etc. They run when your app is being built instead of being part of your app and currently canât be hosted on npm.
Meteor now supports using meteor yarn
instead of meteor npm
. First you have to do meteor npm i -g yarn
, and you have to not be running on Windows.
I have the great misfortune of running on Windows, is there still no hope for me to use meteor yarn?
@asgold8 if you install yarn with meteorâs npm:
meteor npm install -g yarn
You can use meteor yarn
Note that this installs it for a specific meteor version (because each version bundles a specific node and npm version), so you will need to re-install yarn on a meteor update
$ meteor npm install -g yarn
...
updated 1 package in 0.99s
$ meteor yarn
'yarn' is not a Meteor command. See 'meteor --help'.
When I do this on Ubuntu, it works fine, but for Windows 10, it doesnât work, and I canât seem to find a solution to this.
oh weird, I thought thatâd been fixed since the last post. Sorry
The other option is to make sure the version of Node installed on your system is the same, then use yarn
normally.
The issues from using system npm are about building modules for the right node version, so if they match, you can use system wide tools without issue