I'm trying to publish a scoped package to npm, but I keep getting this error on the CLI:
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/@username/dynamic-ui-elements - Forbidden
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy, or
npm ERR! 403 on a server you do not have access to.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/cutler/.npm/_logs/2022-05-16T23_08_36_735Z-debug.log
I have looked all over the internet trying to solve the issue, but none of the suggestions I've seen have worked.
- I am logged in on the CLI
- My npm email is verified
- there is no other package with the same name, as I'm publishing this scoped to my username and I've never published any other packages
- I've tried the command as
npm publish --access public
as well asnpm publish --access=public
- 2FA is enabled
Regarding the 2FA, I've tried both with and without "Require two-factor authentication for write actions" checked. When it IS checked, instead of the above error, I get prompted for a one-time password, but upon entering the generated code from my google authenticator app, I get the E403 again.
These two questions mirror my own, but neither has been answered. Am I using the authenticator wrong? Is there a setting I'm missing?
Here is my package.json
:
{
"name": "@username/dynamic-ui-elements",
"version": "1.0.0",
"description": "Some dynamic UI elements to transform your HTML",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"start": "webpack serve --open"
},
"repository": {
"type": "git",
"url": "git https://github.com/CutlerSheridan/dynamic-ui-elements.git"
},
"author": "Cutler Sheridan <[email protected]>",
"license": "ISC",
"files": [
"src/dynamicUi.js",
"README.md"
],
"bugs": {
"url": "https://github.com/CutlerSheridan/dynamic-ui-elements/issues"
},
"homepage": "https://github.com/CutlerSheridan/dynamic-ui-elements#readme",
"devDependencies": {
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.9.0"
}
}
CodePudding user response:
Despite reading that package.json
100 times, the problem was that I had not changed the auto-generated "name": "@username/dynamic-ui-elements"
to be my real username.