{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreiaayuga63wye55dpvihxgz4suvelmbrfrfvuibhs3d6oablxrcrfy",
"uri": "at://did:plc:wszrgoqdwy3i2dfeub2mt3wf/app.bsky.feed.post/3ml4ik4aqr242"
},
"coverImage": {
"$type": "blob",
"ref": {
"$link": "bafkreicyfzvisagcblpgwcl37ioyp2fybd3b3vnihzcx4ny5lmpk2nolc4"
},
"mimeType": "image/jpeg",
"size": 130494
},
"description": "Why you may be seeing `Failed to replace env in config: ${NPM_TOKEN}` if you don't have an `NPM_TOKEN` set.",
"path": "/posts/2026/05/05/yarn-npm-token/",
"publishedAt": "2026-05-05T15:10:31.000Z",
"site": "https://www.jvt.me",
"tags": [
"blogumentation",
"javascript",
"this is a long-standing issue"
],
"textContent": "Earlier today I was working with a Yarn codebase for the first time on one of my machines, and I hit an awkward error I'd not seen before:\n\n\n % yarn install\n yarn install v1.22.22\n error Error: Failed to replace env in config: ${NPM_TOKEN}\n at /usr/lib/node_modules/yarn/lib/util/env-replace.js:19:13\n at String.replace (<anonymous>)\n at envReplace (/usr/lib/node_modules/yarn/lib/util/env-replace.js:14:16)\n at NpmRegistry.normalizeConfig (/usr/lib/node_modules/yarn/lib/registries/npm-registry.js:423:69)\n at /usr/lib/node_modules/yarn/lib/registries/npm-registry.js:455:36\n at Generator.next (<anonymous>)\n at step (/usr/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)\n at /usr/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13\n info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.\n\n\nA quick search online showed that this is a long-standing issue and can be fixed by exporting an empty `NPM_TOKEN` environment variable:\n\n\n % export NPM_TOKEN=\n % yarn install\n yarn install v1.22.22\n ...\n success Saved lockfile.\n Done in 13.89s.\n",
"title": "Gotcha: Yarn may need an empty NPM_TOKEN set to run",
"updatedAt": "2026-05-05T15:10:31.000Z"
}