Do you want to request a feature or report a bug?
bug / question
What is the current behavior?
How is the registry setting from .npmrc being resolved?
When run as a child process, it seems like the .npmrc from the current working directory (cwd) is being ignored.
If the current behavior is a bug, please provide the steps to reproduce.
In a working directory, say /tmp/foo, there is an embedded executable for yarn-0.27.5.js and a .npmrc with a private registry setting.
$ ls -al /tmp/foo
.npmrc
package.json
yarn-0.27.5.js
Running from shell works fine:
$ pwd
/tmp/foo
$ ./yarn-0.27.5.js install
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 77.89s.
$ cat node_modules/@internal/internal/package.json
{
"name": "@internal/internal",
"version": "2.2.20",
...
Now, when this is executed from a node script as a child process, i.e. w/ execFileSync(), spawnSync(), it gives an error that yarn cannot find the package:
error An unexpected error occurred: "https://registry.yarnpkg.com/@internal%2internal: Not found"
When debugging into the embedded yarn-0.27.5.js, I could figure out that the cwd is correctly set to /tmp/foo. However, the .npmrc is from that directory seems to be ignored.
What is the expected behavior?
It should pick up the .npmrc from the cwd when run as child process.
Please mention your node.js, yarn and operating system version.
$ node --version
v8.4.0
$ /tmp/tmp-282776hDXPWkuFTMF/yarn-0.27.5.js --version
0.27.5
The use case is described in singapore/renovate#766 and singapore/renovate#763
Can you try this with the latest version of yarn and see if it is fixed? 0.27.5 is a bit dated.
This seems to be solved with the 1.x version. See the above linked issues.
This issue still exists in [email protected]. Can we reopen this issue or should I open a new one?
Our current case:
We have a package.json script named upgrade-deps calling a Node.js script which gathers a list of internal project dependencies and finally executes yarn upgrade dependency_1 dependency_2 .... We also have a .npmrc config in our project root specifying a custom registry.
node update-deps.js) everything works out fine. yarn [run] upgrade-deps the .npmrc config is ignored.npm run upgrade-deps) works fine.Noticing the same issue still on yarn 1.10.1. Yarn config is being picked up, but npm config isn't. Here's a reduced test case: https://github.com/JCB-K/yarnrc-child-process-bug
I can confirm that the issue still exists.
Most helpful comment
I can confirm that the issue still exists.