您好,我在部署 npm 包时遇到问题。首先,我通过类型 npmpublish 手动部署它,一切正常,包已发布。但我希望每次我在 main 上推送更改时都会发布它。所以我将该命令添加到我的 github actions CI 配置中
- name: Run build
run: yarn build
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Run Code Online (Sandbox Code Playgroud)
它在 github 包上发布该包,但不在 npm 上发布。我尝试手动发布它,但我收到了错误 npm
$ npm publish
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in.
npm ERR! need auth You need to authorize this machine using `npm adduser`
npm ERR! A complete log of this run can be found …Run Code Online (Sandbox Code Playgroud)