Docs: Please improve the Codeartifact instructions around the package.json requirements
- Dominant language
- TypeScript
- Stars
- 61
- Forks
- 24
- Avg merge
- 6h 45m
- Merged PRs (30d)
- 14
Description
Hi team! I've just spent the last 3 days trying to make Projen's use of publib work, and I found the magic sauce this morning .. but no where in this project or projen is this well documented. (_See AWS Support Case ID `174835671800811` for some of our troubleshooting steps_).
The problem we ran into was the following error:
```
NPM_DIST_TAG=latest NPM_REGISTRY=https://...-....d.codeartifact.us-west-2.amazonaws.com/npm/myrepo npx -p publib@latest publib-npm
(node:17081) ExperimentalWarning: Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
npm notice
npm notice Tarball Contents
npm notice 3.3kB .eslintrc.yml
npm notice 93.2kB .jsii
npm notice 1.2MB API.md..
...
npm error code ENEEDAUTH
npm error need auth This command requires you to be logged in to https://...-....d.codeartifact.us-west-2.amazonaws.com/npm/myrepo
npm error need auth You need to authorize this machine using `npm adduser`
npm error A complete log of this run can be found in: /Users/diranged/.npm/_logs/2025-05-27T15_20_03_599Z-debug-0.log
```
After a bunch of troubleshooting, we realized we had to make sure _multiple_ settings were in-place and these just aren't well documented.
1. The `package.json` needs `name: @/` to be set - you cannot just have `name: `.
2. The `package.json` needs `publishConfig.registry` set (which mimics passing in `--registry ...` to the `npm publish` command)
3. The `publishConfig.registry` value _MUST_ end in a `/`... for example:
a. **INVALID**: `https://...-....d.codeartifact.us-west-2.amazonaws.com/npm/myrepo`
b. **VALID**: `https://...-....d.codeartifact.us-west-2.amazonaws.com/npm/myrepo/`
The last piece (`3`) was the most critical because without it the `npm publish` fails in this really confusing error that sure looks like it should be already logged into the right repository - but it doesn't quite match because of the missing trailing `/`
I'd really like to see the documentation improved here because this was a subtle but painful process to figure out.
Contributor guide
Assessment
This issue has not been assessed yet.