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 https://npm.pkg.github.com/vue-toggle-component npm ERR! 404 npm ERR! 404 '[email protected]' 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": "https://npm.pkg.github.com/" }, "description": "## Project setup ``` yarn install ```", "main": "babel.config.js", "repository": { "type": "git", "url": "git+https://github.com/nehlis/vue-toggle-component.git" }, "keywords": [ "Vue.js", "Toggle", "component", "Lightweight", "Checkbox" ], "author": "Niels Bosman", "license": "ISC", "bugs": { "url": "https://github.com/nehlis/vue-toggle-component/issues" }, "homepage": "https://github.com/nehlis/vue-toggle-component#readme" }
Does anyone know how to fix this?
npm is configured to use the npm public registry at https://registry.npmjs.org by default. Use of the npm public registry is subject to terms of use available at https://docs.npmjs.com/policies/terms. You can configure npm to use any compatible registry you like, and even run your own registry.
The public npm registry is a database of JavaScript packages, each comprised of software and metadata. Open source developers and developers at companies use the npm registry to contribute packages to the entire community or members of their organizations, and download packages to use in their own projects.
Run npm update -g npm. Execute this command by running the command prompt as Administrator npm install -g windows-build-tools. Run npm install inside the project folder where the package. json file is located, if it doesn't work run: npm install --force.
Try npm login
. In case of npm publish
, sometimes misleading message is shown.
Based on the https://npm.pkg.github.com/
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With