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

nx local-registry fails with an exception: 'registry' is not a valid npm version #27135

Closed
1 of 4 tasks
ErickRodrCodes opened this issue Jul 25, 2024 · 2 comments · Fixed by #27350
Closed
1 of 4 tasks

Comments

@ErickRodrCodes
Copy link

ErickRodrCodes commented Jul 25, 2024

Current Behavior

after migrating from 19.3 to 19.5, I noted I can't run anymore local-registry.

In a windows machine, tried powershell and CMD both on the same outcome.

I pinpointed the error here:

image

which points to the repo here:

`npm config set '${scopeName}registry' http://localhost:${options.port}/ --location ${options.location}`,

this could happen as npm config set 'registry' might not be compatible in certain instances. The keyword registry might cause an error on windows computers if it has single quotes around it.

Expected Behavior

The issue can easily be solved my running a conditional command that allows the execution of the right option.

search:

'${scopeName}registry'

replace with

${scopeName ? "'"+scopeName+"registry'" : 'registry'}

as a result it won't throw the respective error.

image

GitHub Repo

No response

Steps to Reproduce

  1. use nvs to setup node 20.14.0
  2. on a specific repo that has plugins, try to run nx local-registry
  3. use a windows machine. it is plausible mac computers might work properly.

Verdaccio will fail to execute with the error 'registry' is not a valid npm option

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.14.0
OS     : win32-x64
npm    : 10.8.2

nx (global)        : 19.3.1
nx                 : 19.5.3
@nx/js             : 19.5.3
@nx/jest           : 19.5.3
@nx/linter         : 19.5.3
@nx/eslint         : 19.5.3
@nx/workspace      : 19.5.3
@nx/angular        : 19.5.3
@nx/devkit         : 19.5.3
@nx/eslint-plugin  : 19.5.3
@nx/playwright     : 19.5.3
@nx/plugin         : 19.5.3
@nx/react          : 19.5.3
@nrwl/tao          : 19.5.3
@nx/vite           : 19.5.3
@nx/web            : 19.5.3
@nx/webpack        : 19.5.3
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/playwright/plugin
@nx/eslint/plugin
@nx/vite/plugin
---------------------------------------
Local workspace plugins:
         @erickrodrcodes/nx-electron-vite

Failure Logs

0 verbose cli C:\Users\tboga\AppData\Local\nvs\default\node.exe C:\Users\tboga\AppData\Local\nvs\default\node_modules\npm\bin\npm-cli.js
1 info using npm@10.8.2
2 info using node@v20.14.0
3 silly config load:file:C:\Users\tboga\AppData\Local\nvs\node\20.14.0\x64\node_modules\npm\npmrc
4 silly config load:file:C:\git-projects\ErickRodrCodes\nx-plugins\.npmrc
5 silly config load:file:C:\Users\tboga\.npmrc
6 silly config load:file:C:\Users\tboga\AppData\Local\nvs\default\etc\npmrc
7 verbose title npm config set 'registry' http://localhost:4873/
8 verbose argv "config" "set" "'registry'" "http://localhost:4873/" "--location" "user"
9 verbose logfile logs-max:10 dir:C:\Users\tboga\AppData\Local\npm-cache\_logs\2024-07-25T21_26_53_392Z-
10 verbose logfile C:\Users\tboga\AppData\Local\npm-cache\_logs\2024-07-25T21_26_53_392Z-debug-0.log
11 info config set "'registry'" "http://localhost:4873/"
12 silly logfile start cleaning logs, removing 2 files
13 verbose stack Error: `'registry'` is not a valid npm option
13 verbose stack     at Config.set (C:\Users\tboga\AppData\Local\nvs\node\20.14.0\x64\node_modules\npm\lib\commands\config.js:186:15)
13 verbose stack     at Config.exec (C:\Users\tboga\AppData\Local\nvs\node\20.14.0\x64\node_modules\npm\lib\commands\config.js:151:20)
13 verbose stack     at C:\Users\tboga\AppData\Local\nvs\node\20.14.0\x64\node_modules\npm\lib\npm.js:251:63
13 verbose stack     at Object.start (C:\Users\tboga\AppData\Local\nvs\node\20.14.0\x64\node_modules\npm\node_modules\proc-log\lib\index.js:101:21)
13 verbose stack     at #exec (C:\Users\tboga\AppData\Local\nvs\node\20.14.0\x64\node_modules\npm\lib\npm.js:250:17)
13 verbose stack     at Npm.exec (C:\Users\tboga\AppData\Local\nvs\node\20.14.0\x64\node_modules\npm\lib\npm.js:207:25)
13 verbose stack     at module.exports (C:\Users\tboga\AppData\Local\nvs\node\20.14.0\x64\node_modules\npm\lib\cli\entry.js:65:29)
14 error `'registry'` is not a valid npm option
15 verbose cwd C:\git-projects\ErickRodrCodes\nx-plugins
16 verbose os Windows_NT 10.0.22631
17 verbose node v20.14.0
18 verbose npm  v10.8.2
19 verbose exit 1
20 verbose code 1
21 error A complete log of this run can be found in: C:\Users\tboga\AppData\Local\npm-cache\_logs\2024-07-25T21_26_53_392Z-debug-0.log

Package Manager Version

10.8.2

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@ErickRodrCodes
Copy link
Author

I identified the change happened in this feature:
28cd0c4

@AgentEnder AgentEnder self-assigned this Jul 25, 2024
ErickRodrCodes pushed a commit to ErickRodrCodes/nx-plugins that referenced this issue Jul 26, 2024
updated to 19.5. it might break local-registry

BREAKING CHANGE: local-registry is broken and it is adviced to fix it via debugging. once fixed,
devs can be able to use verdaccio properly.

re nrwl/nx#27135
FrozenPandaz pushed a commit that referenced this issue Aug 26, 2024
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27135

(cherry picked from commit 00710b9)
Copy link

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 Sep 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants