Renovate Open Source CLI
Bitbucket Cloud
INFO: PR updated (repository=********, branch=renovate/ember-cli-clipboard-0.x)
"pr": 752,
"prTitle": "chore(deps): update dependency ember-cli-clipboard to v0.15.0"
WARN: artifactErrors (repository=********, branch=renovate/ember-cli-clipboard-0.x)
"artifactErrors": [
{
"lockFile": "yarn.lock",
"stderr": "error An unexpected error occurred: \"Failed to replace env in config: ${NPM_TOKEN}\".\nCommand failed: /home/alon/.yvm/versions/v1.22.4/bin/yarn.js install --ignore-engines --ignore-platform --network-timeout 100000 --ignore-scripts\n"
}
]
I would like to run Renovate CLI and have it update that package.json and yarn.lock for my JavaScript project.
This is the command I am running:
RENOVATE_CONFIG_FILE=./renovate.js GITHUB_COM_TOKEN=******** NPM_TOKEN=******** renovate
DEBUG: Repository config (repository=********)
"configFile": "renovate.json",
"config": {
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"],
"npmrc": "***********",
"yarnrc": "***********",
"ignoreDeps": [
"@ember/jquery",
"@ember/optional-features",
"broccoli-asset-rev",
"ember-ajax",
"ember-cli-app-version",
"ember-cli-babel",
"ember-cli-dependency-checker",
"ember-cli-eslint",
"ember-cli-htmlbars-inline-precompile",
"ember-cli-htmlbars",
"ember-cli-inject-live-reload",
"ember-cli-sri",
"ember-cli-template-lint",
"ember-cli-uglify",
"ember-cli",
"ember-data",
"ember-export-application-global",
"ember-load-initializers",
"ember-maybe-import-regenerator",
"ember-qunit",
"ember-resolver",
"ember-source",
"eslint-plugin-ember",
"loader.js",
"qunit-dom"
],
"postUpdateOptions": ["yarnDedupeFewer"],
"rangeStrategy": "update-lockfile"
}
// renovate.json
module.exports = {
extends: ["config:base"],
gitAuthor: "Renovate bot <[email protected]>",
password: "***********",
username: "***********",
platform: "bitbucket",
repositories: ["***********"],
npmrc: "registry=https://nexus.*****/repository/***/\n//nexus.*****/repository/***/:_authToken=***********",
yarnrc: 'registry "https://nexus.*****/repository/***"',
npmToken: "***********",
ignoreNpmrcFile: true
};
@rarkins I set this to "high" and I still get the same error :)
The logs are a bit strange. If you configure npmrc and yarnrc in your renovate.json then they should replace any .npmrc in the repo. But your log message indicates that it's not happening that way. You need two check the logs for all instances of "npmrc" to see if that gives any indication. And of course make sure you are rebasing the PR each time you try.
Hmm @rarkins
I don't think I see anything suspicious.
Does this yarnrc setting in renovate.json look correct:
"yarnrc": "registry \"https://nexus.**.net/repository/**\"\n//nexus.**.net/repository/**/:_authToken=${NPM_TOKEN}",
Should I be passing the authToken in?
Should NPM_TOKEN be passed in if I am setting it while calling renovate CLI?
Some more logs:
DEBUG: Writing repo .npmrc (/tmp/renovate/repos/bitbucket/****) (repository=****, branch=renovate/babel-monorepo)
DEBUG: Writing repo .yarnrc (/tmp/renovate/repos/bitbucket/****) (repository=****, branch=renovate/babel-monorepo)
DEBUG: Writing package.json files (repository=****, branch=renovate/babel-monorepo)
"packageFiles": ["package.json"]
DEBUG: Writing .yarnrc to /tmp/renovate/repos/bitbucket/**** (repository=****, branch=renovate/babel-monorepo)
DEBUG: Writing any updated package files (repository=****, branch=renovate/babel-monorepo)
DEBUG: npmrc file found in repository (repository=****, branch=renovate/babel-monorepo)
DEBUG: Generating yarn.lock for . (repository=****, branch=renovate/babel-monorepo)
DEBUG: Spawning yarn install to create /tmp/renovate/repos/bitbucket/****/yarn.lock (repository=****, branch=renovate/babel-monorepo)
DEBUG: Updating yarn.lock only - skipping node_modules (repository=****, branch=renovate/babel-monorepo)
DEBUG: Using node constraint "^10.16.0 || ^12.13.0" from package.json (repository=****, branch=renovate/babel-monorepo)
DEBUG: Performing lockfileUpdate (yarn) (repository=****, branch=renovate/babel-monorepo)
DEBUG: Performing yarn dedupe fewer (repository=****, branch=renovate/babel-monorepo)
DEBUG: Executing command (repository=****, branch=renovate/babel-monorepo)
"command": "yarn install --ignore-engines --ignore-platform --network-timeout 100000 --ignore-scripts"
DEBUG: lock file error (repository=****, branch=renovate/babel-monorepo)
"err": {
"killed": false,
"code": 1,
"signal": null,
"cmd": "yarn install --ignore-engines --ignore-platform --network-timeout 100000 --ignore-scripts",
"stdout": "yarn install v1.22.4\ninfo If you think this is a bug, please open a bug report with the information provided in \"/tmp/renovate/repos/bitbucket/****/yarn-error.log\".\ninfo Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.\n",
"stderr": "error An unexpected error occurred: \"Failed to replace env in config: ${NPM_TOKEN}\".\nCommand failed: /home/alon/.yvm/versions/v1.22.4/bin/yarn.js install --ignore-engines --ignore-platform --network-timeout 100000 --ignore-scripts\n",
"message": "Command failed: yarn install --ignore-engines --ignore-platform --network-timeout 100000 --ignore-scripts\nerror An unexpected error occurred: \"Failed to replace env in config: ${NPM_TOKEN}\".\nCommand failed: /home/alon/.yvm/versions/v1.22.4/bin/yarn.js install --ignore-engines --ignore-platform --network-timeout 100000 --ignore-scripts\n",
"stack": "Error: Command failed: yarn install --ignore-engines --ignore-platform --network-timeout 100000 --ignore-scripts\nerror An unexpected error occurred: \"Failed to replace env in config: ${NPM_TOKEN}\".\nCommand failed: /home/alon/.yvm/versions/v1.22.4/bin/yarn.js install --ignore-engines --ignore-platform --network-timeout 100000 --ignore-scripts\n\n at ChildProcess.exithandler (child_process.js:303:12)\n at ChildProcess.emit (events.js:321:20)\n at ChildProcess.EventEmitter.emit (domain.js:482:12)\n at maybeClose (internal/child_process.js:1021:16)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)"
},
"type": "yarn"
@Alonski Youz need to put the authToken to the npmrc file. yarnrc file doesn't support that.
@viceice I put it in both 馃槄 Removing it doesn't affect the output
@Alonski you need to remove ignoreNpmrcFile otherwise it your npmrcand yarnrcwill be removed before yarn execution.
Something is still strange though. Either ignoreNpmrc should delete the or npmrc should overwrote it, yet it's still there somehow.
@rarkins @viceice So I stopped Renovate CLI while running it locally.
Then I went to the tmp/renovate folder for this repo.
I checked out the branch for the dependency that I am trying to update.
I notice that I don't have an npmrc or yarnrc file here. This is expected no? I had ignoreNpmrcFile set to true.
I then ran yarn and yarn installed correctly and generated a yarn.lock file.
What is Renovate trying to do that I didn't do?
Do you have any .npmrc or .yarnrc files committed to your repo? If so, then how many?
I have both a .npmrc and a yarnrc file commited to the root of this repo.
BTW if someone wants to hop on a Video call I am free. Can also be tomorrow :)
When you say _authToken=*********** in your .npmrc, have you put an actual token there or have you put the NPM_TOKEN variable yourself?
When you say
_authToken=***********in your.npmrc, have you put an actual token there or have you put theNPM_TOKENvariable yourself?
In the local npmrc I don't have authToken set. It is set in the global npmrc.
This is why I had the npmrc configuration setup in the renovate.json file.
I don't want to commit the token.
Don't configure it in renovate.json then
@rarkins So where should I configure it?
Sorry if I seem difficult. I really don't understand why what I am doing isn't working :)
So after my last comment I removed all npmrc configurations and now it works!
No idea why but thanks for the help!
So @rarkins I am having issues again 馃槶
I have no idea what incantation I uttered last time it worked for me.
error Couldn't find package \"tooltipster\" on the \"npm\" registry.
I am logged into NPM.
I have an npmrc file and a yarnrc file commited to my repo.
.npmrc:
registry=https://nexus.*****/repository/***/\n//nexus.*****/repository/***/:_authToken=***********
always-auth=true
.yarnrc:
registry "https://nexus.*****/repository/***"
renovate.json
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base"],
"ignoreDeps": [
"@ember/jquery",
"@ember/optional-features",
"broccoli-asset-rev",
"ember-ajax",
"ember-cli-app-version",
"ember-cli-babel",
"ember-cli-dependency-checker",
"ember-cli-eslint",
"ember-cli-htmlbars-inline-precompile",
"ember-cli-htmlbars",
"ember-cli-inject-live-reload",
"ember-cli-sri",
"ember-cli-template-lint",
"ember-cli-uglify",
"ember-cli",
"ember-data",
"ember-export-application-global",
"ember-load-initializers",
"ember-maybe-import-regenerator",
"ember-qunit",
"ember-resolver",
"ember-source",
"eslint-plugin-ember",
"loader.js",
"qunit-dom"
],
"postUpdateOptions": ["yarnDedupeFewer"],
"rangeStrategy": "update-lockfile",
"trustLevel": "high",
"prHourlyLimit": 0,
"prCommitsPerRunLimit": 0,
"prConcurrentLimit": 20
}
renovate.js
module.exports = {
extends: ["config:base"],
gitAuthor: "Renovate bot <[email protected]>",
password: process.env.BITBUCKET_PASSWORD,
username: process.env.BITBUCKET_USER,
platform: "bitbucket",
repositories: ["**/**"],
trustLeveL: "high"
};
RENOVATE_CONFIG_FILE=./renovate.js GITHUB_COM_TOKEN=***** NPM_TOKEN=***** BITBUCKET_PASSWORD=***** BITBUCKET_USER=***** renovate
This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon if no further activity occurs.
So this isn't stale. Still have no idea what I'm doing wrong 馃槕
Can you clarify what you meant by this?
In the local npmrc I don't have authToken set. It is set in the global npmrc.
I want to know if the repo has all the auth it needs, or if it's referring to a variable.
@rarkins The .npmrc at the root of the project looks like this:
registry=https://nexus.myprivatenpm.net/repository/npm-repo
always-auth=true
The global .npmrc in my home directory looks like this:
//nexus.myprivatenpm.net/repository/npm-repo/:_authToken=MyPrivateAuthToken*****
Nowhere is the authToken being referenced as a variable.
@Alonski Please add a hostRule of hostType=npm with token=process,env.NPM_TOKEN and baseUrl=https//nexus.myprivatenpm.net/repository/npm-repo/
@viceice Just so I make sure. This should be in my renovate.js file not renovate.json file right?
yes
Hooray @viceice This worked!
Locally I am not able to run Renovate and everything works as expected.
Still having issues getting this to authenticate in Bitbucket Pipelines but I will keep working at that to make sure its not something weird.
Thanks everyone!