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

regression: npmrc should be obeyed during nx migrate #10513

Closed
PKSpeleo opened this issue May 30, 2022 · 15 comments
Closed

regression: npmrc should be obeyed during nx migrate #10513

PKSpeleo opened this issue May 30, 2022 · 15 comments
Assignees
Labels

Comments

@PKSpeleo
Copy link

PKSpeleo commented May 30, 2022

Looks like it was fixed before and resurrected again: #6781

Current Behavior

Calling nx migrate 'my-package' does not obey registry settings from .npmrc. This leads to things like trying to pull latest from npm, or yarn registry instead of the registry pointed to by the workspace.

If an enterprise workspace was using a private registry, and had a custom nx plugin, they would not be able to use nx migrate for their internal migration scripts.

Expected Behavior

Registries and authorization headers in .npmrc should be obeyed by nx migrate

Steps to Reproduce

  • create .npmrc
  • link to the local registry
    nx migrate 'my-package'

Failure Logs

  • nx migrate ignoring npmrc and failing when can't fone package on npm or yarn registry.

Environment

  • macos Monterey 12.4
  • nx - 14.0.3
  • node - 16.14.2
  • yarn - 1.22.11
  • npm - 8.5.0
@PKSpeleo PKSpeleo changed the title npmrc should be obeyed during nx migrate nx migrate regression: npmrc should be obeyed during nx migrate May 31, 2022
@PKSpeleo PKSpeleo changed the title nx migrate regression: npmrc should be obeyed during nx migrate nx migrate regression: npmrc should be obeyed during nx migrate May 31, 2022
@PKSpeleo PKSpeleo changed the title nx migrate regression: npmrc should be obeyed during nx migrate regression: npmrc should be obeyed during nx migrate May 31, 2022
@AgentEnder AgentEnder added the scope: core core nx functionality label May 31, 2022
@AgentEnder AgentEnder self-assigned this May 31, 2022
@colinscz
Copy link

colinscz commented Jun 24, 2022

Hi @AgentEnder

  1. Is there an update on when this ticket will be fixed/merged?

I am also developing inside a company network and this causes a lot of trouble because Nx is ignoring the defined proxy configurations and it's not usable for migrations/updates. In my company certain operations outside of the defined configurations/folders in the *.npmrc are completely blocked.

  1. Is there any workaround you have in mind or you can suggest to do nx migrations in the meantime untils this is fixed?

I saw there has been a release for Nx 14 but unless this is patched in Nx 13 I would have to do the whole migration manually for Angular 14 and Nx 14 which would be frustrating. Worst case we would have to abandon Nx completely as this generates more overhead then benefits as of now...

I appreciate any idea on how to work around this - unfortunately I cannot move the project outside of the company network, that would have been a way to solve it temporarily.

Thanks!

Environment

  • Windows 10
  • nx - 13.10.5
  • node - 16.14.2
  • npm - 8.5.0

@colinscz
Copy link

So in the meantime I can give an update and provide a workaround that worked for me:

I had to set both my environment variables for TEMP and TMP directory to point to the specific folder I had read/write permissions for on my drive and create a dummy subfolder. Through that change I was able to run the migration and could upgrade from NX/Angular 13 to version 14. It's a workaround and not really a sustainable solution but in order to not delay any migration it's an option.

The default NPM Cache on Windows points to %AppData%/npm-cache, maybe modifying %AppData% to point to another directory in the first place would even have been an additional workaround.

Hope that helps everyone that has that issue - maybe worth mentioning this in the Nx docs as a workaround until the issue could be fixed as probably a lot of people in the corporate world do not have full blown admin rights on their dev machines.

@colinscz
Copy link

Hi @AgentEnder

Any rough timeline on when we can expect a fix to be shipped?
A previously working feature was falsly removed and the current workaround is not clean.

@LongLiveCHIEF
Copy link
Contributor

Can you please give this a high priority?

@medmans
Copy link

medmans commented Nov 29, 2022

any news about this bug ?

@medmans
Copy link

medmans commented Nov 30, 2022

@LongLiveCHIEF

In my case i also pass by a company proxy so i'm denied to migrate with command lines, so i procceeded manually to migrate workspace from v13 to v14. I installed the Angular CLI version ( 14.8.6 ) globally and changed package.json files ( the global one, and nested ones for libs).

And running npm install or yarn if you use yarn.

Do not forgot to change the executor to => "executor": "@storybook/angular:start-storybook" and "executor": "@storybook/angular:build-storybook"

It is not the best solution but unblocked me.

@LongLiveCHIEF
Copy link
Contributor

I've found that every time it fails, you can just run yarn or npm install, then after that succeeds, just run the yarn nx migrate --run-migrations again. Not sure if this misses any steps though.

@LongLiveCHIEF
Copy link
Contributor

With the update to nx@15.7+, it now won't even get the latest nx because of proxy failures. it tries to call https://registry.yarnpkg.com/nx to get versions, and fails.

(Only discovered after trying to upgrade from 15.7 -> 15.8)

@LongLiveCHIEF
Copy link
Contributor

Interestingly enough though, running npx nx migrate latest works (as opposed to running yarn nx migrate latest)

@AgentEnder
Copy link
Member

I've seen some reports recently that running via yarn overrides any configured registries because it sets an env variable, its possible this is what you are smashing against. If so, there's not really much we can do.

@LongLiveCHIEF
Copy link
Contributor

That's what i'm afraid of. It may be because running yarn via child process isn't run as the correct user, or from a different path, and not inheriting the right yarn configs as a result.

@colinscz
Copy link

colinscz commented Mar 2, 2023

@AgentEnder in our case we are using npm not yarn, so it's not what's blocking us.

Could you give us an update on the initial questions posted above regarding the changed .npmrc behaviour?

@AgentEnder
Copy link
Member

I don't currently have an update, we didn't change the behavior in regards to .npmrc and are having a hard time troubleshooting this one.

@AgentEnder
Copy link
Member

I think this may have been fixed in #16652

@github-actions
Copy link

github-actions bot commented Jun 4, 2023

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants