我想将我的git仓库发布到npm,以便在其他项目中使用。但是当我运行npm publish
命令时,我会收到以下错误:
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/vue-toggle-component
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
尝试修复错误时,我尝试使用npm adduser
命令和npm login
命令以确保已登录。这两者都未解决我的问题,因为看起来我已经登录了。
我的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"
}
有人知道如何修复这个问题吗?
npm publish <folder>
吗? - Hollyolnpm publish
。除此之外没有其他操作。 - Niels Bosman@namespace
中发布新包。 - user3064538