Package is not publishing to npm (not in the npm registry)

I would like to publish my git repository to npm so I can use it in other projects. But when I run the npm publish command I get the following error:

npm ERR! code E404
npm ERR! 404 Not Found - PUT
npm ERR! 404
npm ERR! 404 'vue-toggle-component@0.1.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\niels\AppData\Roaming\npm-cache\_logs\2020-10-29T10_47_26_952Z-debug.log

When trying to bugfix, I have tried the npm adduser command and the npm login command to make sure I logged in. Both of these did not solve my problem since it looked like I was already logged in.

My package.json:

{ "name": "vue-toggle-component", "version": "0.1.0", "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { "core-js": "^3.6.5", "vue": "^2.6.11" }, "devDependencies": { "@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-service": "~4.5.0", "babel-eslint": "^10.1.0", "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", "vue-template-compiler": "^2.6.11" }, "eslintConfig": { "root": true, "env": { "node": true }, "extends": [ "plugin:vue/essential", "eslint:recommended" ], "parserOptions": { "parser": "babel-eslint" }, "rules": {} }, "browserslist": [ "> 1%", "last 2 versions", "not dead" ], "publishConfig": { "registry": "" }, "description": "## Project setup yarn install ", "main": "babel.config.js", "repository": { "type": "git", "url": "git+" }, "keywords": [ "Vue.js", "Toggle", "component", "Lightweight", "Checkbox" ], "author": "Niels Bosman", "license": "ISC", "bugs": { "url": "" }, "homepage": ""
}

Does anyone know how to fix this?

4

6 Answers

Try npm login. In case of npm publish, sometimes misleading message is shown.

0

Based on the appearing in the error output, you are trying to publish to GitHub Packages and not the npm registry (which are still separate, although GitHub now owns npm). According to the GitHub packages docs:

GitHub Packages only supports scoped npm packages. Scoped packages have names with the format of @owner/name. Scoped packages always begin with an @ symbol. You may need to update the name in your package.json to use the scoped name. For example, "name": "@codertocat/hello-world-npm".

So you'll need to either change your configuration to point to the npm registry rather than the GitHub packages registry, or else change the name field in your package.json to be a scoped package name.

1

I have the same issue the problem comes from the published package is not accessible so you will need to add .npmrc with your private repo to be like this

registry=

or

@yourcompany:registry=
0

As another user mentioned you have to add yourself to the private registry of your company or organization. But if you don't have your .npmrc setup, this command will create the file automatically as well as update your registry:

npm config set registry 

However the most robust way is to simply do

npm login

In the .npmrc file add the below code

always-auth = true
@your_company:registry=
registry=

In GIT bash execute command

npm config set registry
npm install

Screenshotenter image description here

enter image description here

It's all about authentication.

Seems like username/password auth is no more working with npm publish.

You need to generate Access Tokenenter image description here

Then use it to publish

NPM_TOKEN=blahblahblahblaha npm publish

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like