Comments (9)
@Lunatix89 you need to use the =
sign
npm view @namespace/lib versions --@namespace:registry=http://localhost:4873 -ddd
from cli.
@Lunatix89 In your project where you have .npmrc file, do you have package.json file initialized in your project or it's empty folder with only .npmrc?
from cli.
I also have a package.json file in the same directory.
But we are running other npm
commands which override the registry with the --registry
flag and all of them use the override rather than what's defined in the .nmprc
file.
from cli.
I have similer setup where I have a .npmrc file. As from the logs it looks like it's picking up the value from command and not from .npmrc.
~/workarea/rep $ cat .npmrc
registry=http://localhost:4873
~/workarea/rep $ npm view @npm/read versions --registry http://non-ext.com --dddd
npm info using [email protected]
npm info using [email protected]
npm http fetch GET http://non-ext.com/@npm%2fread attempt 1 failed with ENOTFOUND
⠼^C%
Could you please run the command in log level silly (-ddd
) and provide logs if possible ?
from cli.
Sure, here you can see that it recognized my --registry
argument and that I wanted to force it to using my local npm feed, namely verdaccio, but in the end it queried our prod feed from the npmrc (https://pkgs.dev.azure.com..).
PS C:\dev\repos\myorg\myrepo> npm view @mynamespace/react versions -ddd --registry http://localhost:4873
npm verbose cli C:\Program Files\nodejs\node.exe C:\Users\my.name\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm info using [email protected]
npm info using [email protected]
npm silly config load:file:C:\Users\my.name\AppData\Roaming\npm\node_modules\npm\npmrc
npm silly config load:file:C:\dev\repos\myorg\myrepo\.npmrc
npm silly config load:file:C:\Users\my.name\.npmrc
npm silly config load:file:C:\Users\my.name\AppData\Roaming\npm\etc\npmrc
npm verbose title npm view @mynamespace/react versions
npm verbose argv "view" "@mynamespace/react" "versions" "--loglevel" "silly" "--registry" "http://localhost:4873"
npm verbose logfile logs-max:10 dir:c:\dev\npm\cache\_logs\2024-07-24T07_45_06_347Z-
npm verbose logfile c:\dev\npm\cache\_logs\2024-07-24T07_45_06_347Z-debug-0.log
npm silly logfile start cleaning logs, removing 1 files
npm silly logfile done cleaning log files
npm http fetch GET 200 https://pkgs.dev.azure.com/myorg/_packaging/myorg/npm/registry/@mynamespace%2freact 1150ms (cache
updated)
[
'0.1.0-ci.1228', '0.1.0-ci.1231', '0.1.0-ci.1233', '0.1.0-ci.1235',
'0.1.0-ci.1236', '0.1.0-ci.1238', '0.1.0-ci.1241', '0.1.0-ci.1243',
'0.1.0-ci.1251', '0.1.0-ci.1253', '0.1.0-ci.1255', '0.1.0-ci.1257',
'0.1.0-ci.1262', '0.1.0-ci.1263', '0.1.0-ci.1264', '0.1.0-ci.1268',
'0.1.0-ci.1269', '0.1.0-ci.1273', '0.1.0-ci.1274', '0.1.0-ci.1275',
'0.1.0-ci.1281', '0.1.0-ci.1285', '0.1.0-ci.1286', '0.1.0-ci.1287',
'0.1.0-ci.1289', '0.1.0-ci.1290', '0.1.0-ci.1291', '0.1.0-ci.1294',
'0.1.0-ci.1295', '0.1.0-ci.1297', '0.1.0-ci.1307', '0.1.0-ci.1319',
'0.1.0-ci.1321', '0.1.0-ci.1322', '0.1.0-ci.1323', '0.1.0-ci.1324',
'0.1.0-ci.1325', '0.1.0-ci.1326', '0.1.0-ci.1327', '0.1.0-ci.1329',
'0.1.0-ci.1334', '0.1.0-ci.1336', '0.1.0-ci.1338', '0.1.0-ci.1340',
'1.0.0-alpha.1', '1.0.0-alpha.2', '1.0.0-alpha.3', '1.0.0-alpha.4',
'1.0.0-alpha.5', '1.0.0-alpha.6', '1.0.0-alpha.7', '1.0.0-alpha.8',
'1.0.0-alpha.9', '1.0.0-alpha.10', '1.0.0-alpha.11', '1.0.0-alpha.12',
'1.0.0-beta.0', '1.0.0-beta.1', '1.0.0-beta.2', '1.0.0-beta.3',
'1.0.0-beta.4', '1.0.0-beta.5', '1.0.0-beta.6', '1.0.0-beta.7',
'1.0.0-beta.8', '1.0.0-beta.9', '1.0.0-beta.12', '1.0.0-dev.22547',
'1.0.0-dev.28277', '1.0.0-dev.28703', '1.0.0', '1.0.1',
'1.0.2', '1.0.3', '1.0.4', '1.0.6',
'1.0.7', '1.1.0-alpha.0', '1.1.0-alpha.1', '1.1.0-alpha.2',
'1.1.0', '1.1.1', '1.1.2', '1.1.3',
'1.1.4', '1.1.5', '1.2.0-alpha.0', '1.2.0-alpha.1',
'1.2.0', '1.2.1', '1.2.2', '1.2.3',
'1.2.4', '1.2.5', '1.3.0-alpha.1', '1.3.0',
'1.3.1', '1.3.2', '1.3.3', '1.4.0-alpha.0',
'1.4.0-alpha.1', '1.4.0-alpha.2', '1.4.0-alpha.3', '1.4.0-alpha.4',
'1.4.0-beta.0', '1.4.0-beta.1', '1.4.0-beta.2', '1.4.0-beta.3',
'1.4.0-beta.4', '1.4.0', '1.4.1', '1.4.2',
'1.4.3', '1.4.4', '1.4.5', '1.5.0-alpha.0',
'1.5.0-alpha.1', '1.5.0-alpha.2', '1.5.0-alpha.3', '1.5.0-beta.0',
'1.5.0-beta.1', '1.5.0-beta.2', '1.5.0-beta.3', '1.5.0',
'1.5.1', '1.5.2', '1.5.3', '1.5.4',
'1.5.5', '1.5.6', '1.6.0-alpha.0', '1.6.0-alpha.4',
'1.6.0-alpha.5', '1.6.0-alpha.6', '1.6.0-alpha.7', '1.6.0-alpha.8',
'1.6.0-alpha.9', '1.6.0-alpha.10'
]
npm verbose cwd C:\dev\repos\myorg\mypackage
npm verbose os Windows_NT 10.0.19045
npm verbose node v22.2.0
npm verbose npm v10.8.0
npm verbose exit 0
npm info ok
from cli.
I'm just wondering but could it be because in my npmrc I have an entry specific for my namespace?
I just realized that I never posted the npmrc here so here it is:
registry=https://registry.npmjs.org
@mynamespace:registry=https://pkgs.dev.azure.com/myorg/_packaging/myorg/npm/registry/
always-auth=true
//localhost:4873/:_authToken="12345"
When I run npm view react versions --registry http://localhost:4873
it queries the localhost:4873
address instead of registry.npmjs.org
.
But.. imho it should still use the registry from the argument provided to the command?
from cli.
@Lunatix89 Yes. Once the scope is associated with registry in config then all the request for that scoped package will be done to that scoped registry endpoint, It's happening because npm merges your all your configs i.e. Global, User, Project and then command line flags and you are only overriding registry value and not the scoped:registry value. You can try something like this
npm view @namespace/react versions --@namespace:registry=http://localhost:4873
Closing this as it's working as intended.
from cli.
That really makes sense, I somehow did not concider that one could provide a "dynamic" @namespace:registry
argument.
However, this seems to trigger another bug, output.endsWith is not a function
, like you can see here:
npm view @namespace/lib versions --@namespace:registry http://localhost:4873 -ddd
npm verbose cli C:\Program Files\nodejs\node.exe C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm info using [email protected]
npm info using [email protected]
npm silly config load:file:C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\npmrc
npm silly config load:file:C:\WINDOWS\system32\.npmrc
npm silly config load:file:C:\Users\user.name\.npmrc
npm silly config load:file:C:\Users\user.name\AppData\Roaming\npm\etc\npmrc
npm verbose title npm view @namespace/lib versions http://localhost:4873
npm verbose argv "view" "@namespace/lib" "versions" "--@namespace:registry" "http://localhost:4873" "--loglevel" "silly"
npm verbose logfile logs-max:10 dir:c:\dev\npm\cache\_logs\2024-07-30T08_53_53_136Z-
npm verbose logfile c:\dev\npm\cache\_logs\2024-07-30T08_53_53_136Z-debug-0.log
npm silly logfile start cleaning logs, removing 2 files
npm verbose stack TypeError: output.endsWith is not a function
npm verbose stack at removeTrailingSlashes (C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\util\trailing-slashes.js:4:17)
npm verbose stack at new RegistryFetcher (C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\registry.js:36:28)
npm verbose stack at FetcherBase.get (C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\fetcher.js:478:14)
npm verbose stack at packument (C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\lib\index.js:21:30)
npm verbose stack at #getData (C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\lib\commands\view.js:135:26)
npm verbose stack at #viewPackage (C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\lib\commands\view.js:112:47)
npm verbose stack at View.exec (C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\lib\commands\view.js:70:28)
npm verbose stack at C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\lib\npm.js:251:63
npm verbose stack at Object.start (C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\node_modules\proc-log\lib\index.js:101:21)
npm verbose stack at #exec (C:\Users\user.name\AppData\Roaming\npm\node_modules\npm\lib\npm.js:250:17)
npm error output.endsWith is not a function
npm verbose cwd C:\WINDOWS\system32
npm verbose os Windows_NT 10.0.19045
npm verbose node v22.2.0
npm verbose npm v10.8.2
npm verbose exit 1
npm verbose code 1
npm error A complete log of this run can be found in: c:\dev\npm\cache\_logs\2024-07-30T08_53_53_136Z-debug-0.log
So either it's not officially supported or there is a bug the code.
from cli.
Oh.. that makes sense now.
Thanks a lot, it works like a charm :)
from cli.
Related Issues (20)
- Feature request: Add config option to prevent accidental installation of packages in directories without package.json HOT 2
- [BUG] npm publish <package-spec> in a workspace is not taking package-spec into account HOT 1
- [BUG] package binaries with .hidden folders don't install globally HOT 1
- [BUG] No lifecycle hooks are run at all HOT 3
- [BUG] `npm update -g ds` removes all global packages and npm itself HOT 1
- [BUG] DevDependancy are installed in production when also marked as peerDependenciesMeta optional HOT 3
- [question] Whether it is possible to upload to npmjs.org manually? HOT 1
- [BUG] `npm outdated --json` doesn't provide distinct workspace packages information HOT 1
- [BUG] git dependencies cause weird behaviour when git is not installed HOT 1
- [BUG] DevDependancy are installed in production when also marked as optional peerDependencies HOT 5
- [BUG] outdated does not report packages in unnamed workspaces HOT 1
- [BUG] Inconsistent audit json
- [BUG] `npm i` does not set `["packages"][""]["name"]` in package-lock.json when there is no name in package.json while `npm audit fix` sets that to project's directory name HOT 5
- [BUG] `npm install` sometimes removes indirect dependencies if a parent node was deleted from the lockfile HOT 2
- [BUG] The .gitignore file is renamed to .npmignore when npm install HOT 1
- [BUG] The package-lock.json file depends on node_modules, which will cause the lock generated by npm i to be inconsistent after the lock file is deleted when some packages that depend on the system architecture (such as node-unix-socket) are installed again. HOT 2
- Start HOT 1
- [BUG] Project name was being added to dependencies automatically HOT 6
- Align npm packages to npm 10's node engine range
- Problem: CORS Error When Accessing Swagger API Deployed on AWS EC2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.