Repository navigation
Tracking: Third party NPM replacements #3886
Description
Activity
Maybe for now just add a note about the
skip-npmflag advertising it as "for users who want to use alternate package managers likeyarnorcnpm".Discussing this more with @IgorMinar, we came to the point where the following would be acceptable:
- On
ng new, if we detect eitheryarnorcnpm, we output a warning message to users, telling them they canng set --global packageManager=yarnto use it globally with new projects. - Users can then set it globally and recreate the project, or
yarn installlocally instead.
NPM is only used when running
initandnew, and sinceinitis used bynewwe should just put the warning oninit.Reacted by beeman, Krzysztof Lityński, Robert Dean, cloud602, Chris Thielen, Bret Hubbard and miy4mori- On
- addedP3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent
on Jan 24, 2017 For those subscribing to this issue, particularly the yarn crowd, here's a 6 minutes video that shows how yarn works with Angular CLI today:
Reacted by Bogac Guven, Chris Thielen, Christopher Cadieux and ernest jonestl;dw:
ng new test-project -sn cd test-project yarn git add yarn.lockReacted by Meligy and Lucien KnechtliFor Yarn in particular, you also need to ensure you have 0.19 or higher. We had people report issues in the past where upgrading from 0.17 to 0.19 fixed it for them, and I'm aware of issues with global packages in general that were show stoppers to me and others, and were fixed in 0.19.
I've added a written version with explanation here:
https://www.gurustop.net/blog/2017/01/26/use-yarn-npm-with-angular-cli
Reacted by Bogac Guven and matthew harwoodTL;DR:
ng set --global packageManager=yarn ng new <your-app-name>Reacted by Ryan Woodcox, Doug Ludlow, Vojtech Mašek, tamasfoldi and Matt CarboneHi, I tried using yarn by doing
ng set --global packagemanager=yarnbut I am getting the following error:Successfully initialized git. Installing packages for tooling via yarn. warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries. error An unexpected error occurred: "https://registry.yarnpkg.com/@angular%2fcommon: getaddrinfo ENOENT registry.yarnpkg.com:443".angular-automatic-lock-bot commented
on Sep 7, 2019 More actionsThis 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.
- locked and limited conversation to collaborators
on Sep 7, 2019
In the recent weeks, multiple have requested support for the following two NPM replacements:
yarn, which has a lot of speed improvements. Many users reported problems using yarn with the CLI in some occasions.cnpm, which uses an NPM cache specially made for China. It's not useful for anyone outside of China itself.What I suggest is embracing the fact that users can have an
angular-cli.jsonfile in their home folder to specify which NPM replacement they want to use.Something like adding to the configuration:
{ // ... "packageManager": "npm" // or "cnpm" or "yarn" }And having special code for some of them when the user creates a new package.
I think this is the cleanest way to do it. If we document it well, users won't have a problem. They can even replace its value per-project.
cc @IgorMinar