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

[rush] Unclear how to switch to npm package manger #1254

Open
code-brewer opened this issue Apr 30, 2019 · 6 comments
Open

[rush] Unclear how to switch to npm package manger #1254

code-brewer opened this issue Apr 30, 2019 · 6 comments
Labels
enhancement The issue is asking for a new feature or design change needs design The next step is for someone to propose the details of an approach for solving the problem

Comments

@code-brewer
Copy link

I have a working rush demo, then change to npm by edit rush.json : comment out "pnpmVersion": "2.15.1" and select "npmVersion": "4.5.0" .

But comands like rush unlink, rush purge, rush update give out Error:
Rush Multi-Project Build Tool 5.7.1 - https://rushjs.io ERROR: An unrecognized file "pnpmfile.js" was found in the Rush config folder: ~/rushDemo/common/config/rush

If i delete common/config/rush/pnpmfile.js, then got error message :
RROR: An unrecognized file "shrinkwrap.yaml" was found in the Rush config folder: ~/rushDemo/common/config/rush

Can anyone show me how to use npm instead of pnpm ?

@octogonz
Copy link
Collaborator

octogonz commented Apr 30, 2019

Delete both those files. (They are "unrecognized" because they're not used by NPM, and generally Rush doesn't want misleading files lying around to confuse people or tools.)

Then run rush update to create an NPM-specific file.

Rush's behavior does seem a little misleading. Perhaps we should document it better or improve the error message, if someone can propose a better behavior.

@iclanton FYI

@octogonz octogonz changed the title unable to switch to npm package manger [rush] Unclear how to switch to npm package manger Apr 30, 2019
@octogonz octogonz added enhancement The issue is asking for a new feature or design change needs design The next step is for someone to propose the details of an approach for solving the problem labels Apr 30, 2019
@code-brewer
Copy link
Author

Thank for your help. It works. Didn't expect i was just one step away from success, but i was horrified and stop by the potentially endless files deletion.

It would be better to note down this work-around in document even if can not gracefully solve this problem currently.

@nickpape
Copy link
Contributor

nickpape commented May 2, 2019

Yeah, we could have Rush collect a list of all unrecognized files. Also, we store the last package manager that was used for an install in the temp folder, so we could detect the package manager change and leave a message like:

Rush has detected you may be switching from PNPM to NPM.
In order to do so, Rush will need to delete the following PNPM-specific files:

- /common/config/rush/pnpmfile.js
- /shrinkwrap.yaml

If no new shrinkwrap file is found, you could also add:

Additionally, no NPM shrinkwrap file was detected.
You may also need to run `rush update`.

@gabrielliwerant
Copy link

gabrielliwerant commented Jan 12, 2021

Suggestion: Instead of rush init generating files based on pnpm by default, allow the user to select which package manager they use by prompt and then generate initial files accordingly. This would prevent confusion when switching a config value (which I would not expect to complain about auto-generated files from initial setup) and would be in line with how npm init works.

@tmeindle
Copy link

tmeindle commented May 4, 2021

upgrading pnpmVersion to 6.2.5 in rush.json also produces this message as well

@GongT
Copy link
Contributor

GongT commented Jul 18, 2021

pnpm 6 change pnpmfile.js to .pnpmfile.cjs, we need rename it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is asking for a new feature or design change needs design The next step is for someone to propose the details of an approach for solving the problem
Projects
Status: Needs triage
Development

No branches or pull requests

6 participants