{"record":{"id":"b09f20a60631975b","repo":"nocobase/nocobase","slug":"no-npm-registry-was-provided-for-source-publish-n","errorCode":null,"errorMessage":"No npm registry was provided for source publish.\\nStart the local source registry with `nb source registry start`, or pass `--npm-registry <url>` explicitly.","messagePattern":"No npm registry was provided for source publish\\.\\\\nStart the local source registry with `nb source registry start`, or pass `--npm-registry <url>` explicitly\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/cli/src/lib/source-publish.ts","lineNumber":48,"sourceCode":"  return trimValue(value).replace(/[^A-Za-z0-9]+/g, '').slice(0, 16);\n}\n\nfunction normalizeSnapshotBaseVersion(baseVersion: string): string {\n  return trimValue(baseVersion).replace(/(?:-snapshot\\.\\d{8}\\.[A-Za-z0-9]+)+$/, '');\n}\n\nexport async function resolveSourcePublishRegistry(explicitRegistry?: string): Promise<string> {\n  const normalized = trimValue(explicitRegistry);\n  if (normalized) {\n    return normalized;\n  }\n\n  const info = await resolveSourceRegistryInfo();\n  if (info.status === 'running') {\n    return info.url;\n  }\n\n  throw new Error(\n    [\n      'No npm registry was provided for source publish.',\n      'Start the local source registry with `nb source registry start`, or pass `--npm-registry <url>` explicitly.',\n    ].join('\\n'),\n  );\n}\n\nexport async function resolveGitSha(cwd?: string): Promise<string> {\n  return await commandOutput('git', ['rev-parse', '--short', 'HEAD'], {\n    cwd,\n    errorName: 'git rev-parse',\n  });\n}\n\nexport async function readRootVersion(cwd?: string): Promise<string> {\n  const root = resolveProjectCwd(cwd);\n  const { readFile } = await import('node:fs/promises');\n  const content = await readFile(path.join(root, 'lerna.json'), 'utf8');","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/nocobase/nocobase/blob/fa42722fefe44265490dff2c27d79e2882bce4fa/packages/core/cli/src/lib/source-publish.ts#L30-L66","documentation":"resolveSourcePublishRegistry determines which npm registry to publish source packages to. It first honors an explicitly provided registry URL, then tries the locally managed source registry. If neither exists and no registry is currently running, it throws with guidance to either start the local registry or pass --npm-registry.","triggerScenarios":"Running `nb source publish` without --npm-registry while the local source registry (`nb source registry start`) is not running and resolveSourceRegistryInfo() reports status !== 'running'.","commonSituations":"Fresh environment where the local registry was never started; the registry daemon crashed or was stopped; user forgot the --npm-registry flag when publishing to a remote registry.","solutions":["Start the local source registry: `nb source registry start`, then retry the publish.","Pass the target registry explicitly: `nb source publish --npm-registry https://your-registry.example.com`.","Check the registry daemon status/logs if you expected it to be running (`nb source registry status` or equivalent)."],"exampleFix":"// before\nnb source publish\n// after (pick one)\nnb source registry start && nb source publish\nnb source publish --npm-registry https://registry.example.com","handlingStrategy":"validation","validationCode":"// precheck before nb source publish\nconst registry = process.env.npm_config_registry; // or explicit URL\nconst localRunning = await isSourceRegistryRunning(); // probe via CLI status\nif (!registry && !localRunning) {\n  throw new Error('start local registry (nb source registry start) or set --npm-registry');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await sourcePublish(options);\n} catch (err) {\n  if (err.message.includes('No npm registry was provided for source publish')) {\n    // start the local registry or retry with { npmRegistry: url }\n  }\n}","preventionTips":["Start `nb source registry start` as part of environment bootstrap.","Always pass --npm-registry in CI or remote environments.","Script a health check of the registry before publishing."],"tags":["npm","registry","configuration","cli","publish"],"backgroundTag":"missing-registry-config","analyzedSha":"fa42722fefe44265490dff2c27d79e2882bce4fa","analyzedAt":"2026-09-01T00:54:31.202Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}