What is the syntax for scoped registries?
This issue was closed before this comment was resolved.
What is the current behavior?
@[scope]:registry=[registry URL]
in .npmrc
is ignored / results in "https://registry.yarnpkg.com/@[scope]%2f[package]: Not found"
@[scope]:registry "[registry URL]"
in .yarnrc
results in "Unknown token 1:0 in [project path]\.yarnrc"
What is the expected behavior?
Install @[scope]/[package] from [registry URL].
Please mention your node.js, yarn and operating system version.
Windows 10 x64
yarn versions v0.24.6
node -v v8.1.2
@gatimus Putting "@[scope]:registry"
into quotes inside of .yarnrc works for me
So like "@[scope]:registry" "[registry URL]"
?
I now get error Couldn't find package "@[scope]/[package]" on the "npm" registry.
like it is ignored.
Is there documentation I'm not finding?
It would be really helpful to have some instructions on how to accomplish this 👍 It is quite painful to always switch between different registries manually.
@betalb's proposed solution does not work for me either.
I have .npmrc & .yarnrc configured as following:
.npmrc
registry=http://nexus.dev/repository/npm-proxy/
@mycompany:registry=http://nexus.dev/repository/npm-releases/
.yarnrc
registry "http://nexus.dev/repository/npm-proxy/"
"@mycompany:registry" "http://nexus.dev/repository/npm-releases/"
And yarn add @mycompany:package-name
works fine for me
And when running in verbose mode, I don't see any requests to registry.yarnpkg.com
I just re-updated everything and made a simple test project and its now working for me.
node -v
v8.1.3
yarn --version
0.27.5
package.json
{
"name": "yarn-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "UNLICENSED",
"dependencies": {
"@mycomp/mypkg": "1.2.3",
"typescript": "^2.4.1"
}
}
.npmrc
@mycomp:registry=https://mycomp.pkgs.visualstudio.com/_packaging/MyComp/npm/registry
.yarnrc
"@mycomp:registry" "https://mycomp.pkgs.visualstudio.com/_packaging/MyComp/npm/registry"
yarn install
yarn install v0.27.5
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 2.53s.
@rossgardt any luck?
I'm having an issue with this still.
Yarn version 1.0.2
Node version 6.10.3
npm version 3.10.10
yarn config list
yields the following:
yarn config v1.0.2
info yarn config
{ 'version-tag-prefix': 'v',
'version-git-tag': true,
'version-git-sign': false,
'version-git-message': 'v%s',
'init-version': '1.0.0',
'init-license': 'MIT',
'save-prefix': '^',
'ignore-scripts': false,
'ignore-optional': false,
registry: 'https://registry.yarnpkg.com',
'strict-ssl': true,
'user-agent': 'yarn/1.0.2 npm/? node/v6.10.3 darwin x64',
email: '<my-email>',
lastUpdateCheck: 1505331853189,
username: '<my-username>',
'@<my-company>:registry': 'https://registry.npmjs.org/' }
info npm config
{ '@<my-company>:registry': 'https://registry.npmjs.org/',
'//registry.npmjs.org/:_authToken': '<my-auth-token>',
'save-prefix': '~' }
This is after using a similar setup as @gatimus posted. However, whenever I install/update a package in the @<my-company>
scope, it resolves from the yarn registry. I can solve this by setting registry "https://registry.npmjs.org/"
, but then _every_ package resolves to npm, not just my scoped ones.
Should I keep tracking this in this ticket, or open a new one?
@gatimus Is this still working for you in 1.0.2? If it is, I'll reopen this in a new issue.
I don't know. No longer using yarn or scoped packages.
I'm still having this issue in 1.3.2.
Me too. It worked at one point months ago. Now it doesn't and can't figure out why.
i have the same problem in 1.3.2
scoped registry is still not working....
same problem with v1.2.1 and v1.3.2
Would you mind reopening this issue @gatimus ? I know you aren't affected - but others still definitely are and better to reopen than file an identical issue methinks :)
Still experiencing this with 1.2.1 and 1.3.2
Also experiencing this issue 1.2.1
Still the issue with 1.13.0.
I also encountered this problem, but I added the _auth
configuration item to work.
.npmrc
@xxx:registry=http://xxx.xxx.xxx.xxx/repository/npm-public
_auth=xxxx
_auth = btoa('username:password')
It worked!
@eeve thanks for suggestion, you reminded me it's time to give it a try again.
So, the good news is that it works. There was no need in adding _auth
though, normal authentication from npm login
is enough. I've downloaded latest version 1.17.3 and added .yarnrc
"@myscope:registry" "https://repository.url"
I thins it's fixed now, so give it another shot with 1.17.3, people!
I have upgraded to 1.17.3 and still having this issue. I have my scoped registry set and can see that it is indeed hitting the scoped registry URL but still getting "Couldn't find package "@scope/package-name" on the "npm" registry".
I am using Artifactory to store the packages as an NPM package. NPM finds the package just fine but Yarn seems not to be able to.
list-experience git:(SENT2-12369-dashboard-updates) ✗ yarn add @forge/webpack-img --verbose
yarn add v1.17.3
verbose 0.278 Checking for configuration file "/Users/Desktop/Code/list-experience/.npmrc".
verbose 0.278 Checking for configuration file "/Users/.npmrc".
verbose 0.279 Found configuration file "/Users/.npmrc".
verbose 0.279 Checking for configuration file "/usr/local/etc/npmrc".
verbose 0.28 Checking for configuration file "/Users/Desktop/Code/list-experience/.npmrc".
verbose 0.28 Checking for configuration file "/Users/Desktop/Code/.npmrc".
verbose 0.28 Checking for configuration file "/Users/Desktop/.npmrc".
verbose 0.28 Checking for configuration file "/Users/.npmrc".
verbose 0.28 Found configuration file "/Users/.npmrc".
verbose 0.281 Checking for configuration file "/Users/.npmrc".
verbose 0.283 Checking for configuration file "/Users/Desktop/Code/list-experience/.yarnrc".
verbose 0.283 Checking for configuration file "/Users/.yarnrc".
verbose 0.283 Found configuration file "/Users/.yarnrc".
verbose 0.283 Checking for configuration file "/usr/local/etc/yarnrc".
verbose 0.283 Checking for configuration file "/Users/Desktop/Code/list-experience/.yarnrc".
verbose 0.287 Checking for configuration file "/Users/Desktop/Code/.yarnrc".
verbose 0.288 Checking for configuration file "/Users/Desktop/.yarnrc".
verbose 0.288 Checking for configuration file "/Users/.yarnrc".
verbose 0.288 Found configuration file "/Users/.yarnrc".
verbose 0.288 Checking for configuration file "/Users/.yarnrc".
verbose 0.293 current time: 2019-08-09T18:50:26.074Z
[1/4] 🔍 Resolving packages...
verbose 0.632 Performing "GET" request to "https://localhost:3000/v1/packages/@forge%2fwebpack-img".
verbose 0.679 Request "https://localhost:3000/v1/packages/@forge%2fwebpack-img" finished with status code 200.
verbose 0.691 Error: Couldn't find package "@forge/webpack-img" on the "npm" registry.
at MessageError.ExtendableBuiltin (/usr/local/Cellar/yarn/1.17.3/libexec/lib/cli.js:721:66)
at new MessageError (/usr/local/Cellar/yarn/1.17.3/libexec/lib/cli.js:750:123)
at NpmResolver.<anonymous> (/usr/local/Cellar/yarn/1.17.3/libexec/lib/cli.js:50647:15)
at Generator.next (<anonymous>)
at step (/usr/local/Cellar/yarn/1.17.3/libexec/lib/cli.js:304:30)
at /usr/local/Cellar/yarn/1.17.3/libexec/lib/cli.js:315:13
at process._tickCallback (internal/process/next_tick.js:68:7)
error Couldn't find package "@forge/webpack-img" on the "npm" registry.
Yarn config list
list-experience git:(SENT2-12369-dashboard-updates) ✗ yarn config list
yarn config v1.17.3
info yarn config
{ 'version-tag-prefix':
'v',
'version-git-tag':
true,
'version-commit-hooks':
true,
'version-git-sign':
false,
'version-git-message':
'v%s',
'init-version':
'1.0.0',
'init-license':
'MIT',
'save-prefix':
'^',
'bin-links':
true,
'ignore-scripts':
false,
'ignore-optional':
false,
registry:
'https://registry.yarnpkg.com',
'strict-ssl':
false,
'user-agent':
'yarn/1.17.3 npm/? node/v10.15.1 darwin x64',
'@forge:registry':
'https://localhost:3000/v1/packages/',
lastUpdateCheck:
1565375741839 }
info npm config
{ '@scuf:registry':
'https://artifactory-na.honeywell.com/artifactory/api/npm/SCUF-10305-stable-npm-local/',
'@forge:registry':
'https://localhost:3000/v1/packages/',
python:
'/usr/bin/python' }
Okay, flagging this for myself to follow up and will check what’s on my end.
Most helpful comment
I have .npmrc & .yarnrc configured as following:
.npmrc
.yarnrc
And
yarn add @mycompany:package-name
works fine for meAnd when running in verbose mode, I don't see any requests to
registry.yarnpkg.com