Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking: Third party NPM replacements #3886

Closed
2 tasks
hansl opened this issue Jan 6, 2017 · 9 comments · Fixed by #4321
Closed
2 tasks

Tracking: Third party NPM replacements #3886

hansl opened this issue Jan 6, 2017 · 9 comments · Fixed by #4321
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@hansl
Copy link
Contributor

hansl commented Jan 6, 2017

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.json file 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

@Meligy
Copy link
Contributor

Meligy commented Jan 8, 2017

Maybe for now just add a note about the skip-npm flag advertising it as "for users who want to use alternate package managers like yarn or cnpm".

@hansl
Copy link
Contributor Author

hansl commented Jan 11, 2017

Discussing this more with @IgorMinar, we came to the point where the following would be acceptable:

  • On ng new, if we detect either yarn or cnpm, we output a warning message to users, telling them they can ng set --global packageManager=yarn to use it globally with new projects.
  • Users can then set it globally and recreate the project, or yarn install locally instead.

NPM is only used when running init and new, and since init is used by new we should just put the warning on init.

@Brocco Brocco mentioned this issue Jan 20, 2017
38 tasks
@filipesilva filipesilva added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: enhancement labels Jan 24, 2017
@Meligy
Copy link
Contributor

Meligy commented Jan 25, 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:

https://youtu.be/jqvk1qBb4CY

@christopherthielen
Copy link

tl;dw:

ng new test-project -sn
cd test-project
yarn
git add yarn.lock

@Meligy
Copy link
Contributor

Meligy commented Jan 26, 2017

For 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.

@Meligy
Copy link
Contributor

Meligy commented Jan 26, 2017

I've added a written version with explanation here:

https://www.gurustop.net/blog/2017/01/26/use-yarn-npm-with-angular-cli

@sivabudh
Copy link

TL;DR:

ng set --global packageManager=yarn
ng new <your-app-name>

@RamVellanki
Copy link

Hi, I tried using yarn by doing ng set --global packagemanager=yarn but 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
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants