我一直在经历噩梦,试图让lerna在我的ci管道中发布。
我设法使脚本从git中拉出以检查标签,并且我找到了withNPM管道插件。因为我正在使用lerna
发布多个软件包,所以必须将插件在工作空间中创建的.npmrc
文件移动到主目录的根目录,以便所有软件包都可以访问它。>
NPM插件使用jenkins配置文件来创建.npmrc
文件。看起来像这样:
//registry.npmjs.com/:_authToken=TOKEN
这是我在詹金斯管道中拥有的东西。
stage('lerna publish') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'cb8acd82-3a50-4a94-9d5f-44b04856e6fd', keyFileVariable: 'GITHUB_KEY')]) {
sh 'echo ssh -i $GITHUB_KEY -l git -o StrictHostKeyChecking=no \\"\\$@\\" > ./run_ssh.sh'
sh 'chmod +x ./run_ssh.sh'
withEnv(['GIT_SSH=./run_ssh.sh']) {
withNPM(npmrcConfig: 'da4e5199-b04b-41b6-a03f-dfbcc344f701') {
sh "rm -rf ~/.npmrc"
sh 'mv ./.npmrc ~/.npmrc'
sh 'npm config set registry https://registry.npmjs.com/'
sh 'git config --global user.email "thomas@reggi.com"'
sh 'git config --global user.name "reggi"'
sh 'git checkout master'
sh 'git pull origin master --force'
sh 'npm run lerna-publish'
}
}
}
}
}
这是错误:
lerna info auto-confirmed
lerna info publish Publishing packages to npm...
lerna ERR! npm publish --ignore-scripts exited 1 in '@reggi/help.filter-until'
lerna ERR! npm publish --ignore-scripts stderr:
npm notice
npm notice package: @reggi/help.filter-until@0.0.20
npm notice === Tarball Contents ===
npm notice 1.5kB package.json
npm notice 609B index.build.js
npm notice === Tarball Details ===
npm notice name: @reggi/help.filter-until
npm notice version: 0.0.20
npm notice package size: 997 B
npm notice unpacked size: 2.1 kB
npm notice shasum: a6db6d4dc02f05548c22fe2e034832ac02252633
npm notice integrity: sha512-6oAFaXqZMREsh[...]GnMcnIxXUBINg==
npm notice total files: 2
npm notice
npm ERR! code ENEEDAUTH
npm ERR! need auth auth required for publishing
npm ERR! need auth You need to authorize this machine using `npm adduser`
我发现我与上述网址不一致,并将它们都更改为.com
,现在我遇到了这个问题:
lerna info auto-confirmed
lerna info publish Publishing packages to npm...
lerna ERR! npm publish --ignore-scripts exited 1 in '@reggi/help.filter-until'
lerna ERR! npm publish --ignore-scripts stderr:
npm notice
npm notice package: @reggi/help.filter-until@0.0.23
npm notice === Tarball Contents ===
npm notice 1.5kB package.json
npm notice 609B index.build.js
npm notice === Tarball Details ===
npm notice name: @reggi/help.filter-until
npm notice version: 0.0.23
npm notice package size: 1.0 kB
npm notice unpacked size: 2.1 kB
npm notice shasum: 60ee325b219abdae06a75cfe45bc66096f715187
npm notice integrity: sha512-o4ahyOWAsUk3j[...]O/3MH2Tpv1tOQ==
npm notice total files: 2
npm notice
npm ERR! publish Failed PUT 404
npm ERR! code E404
npm ERR! 404 Not found : @reggi/help.filter-until
npm ERR! 404
npm ERR! 404 '@reggi/help.filter-until' 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.
答案 0 :(得分:0)
我具有使用.org
域的令牌设置,并将注册表设置为.com
域。 :(