npm run pub后报错

来源:13-4 ts-axios 编译与发布 运行部署脚本

慕少8034756

2020-02-10

老师,在提交后,提示如下错误,到百度中也搜索了,查询不到相关问题的处理方法,请帮忙指导一下!
Enter release version:
1.0.1
Realeaing 1.0.1 - are you sure? (y/n)y
Realeaing 1.0.1 …
On branch master
nothing to commit, working tree clean
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ts-axios-rockyhu@1.0.0-dev pub: sh release.sh
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ts-axios-rockyhu@1.0.0-dev pub script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rockyhu/.npm/_logs/2020-02-10T13_07_47_713Z-debug.log

写回答

2回答

慕少8034756

提问者

2020-02-10

#!/usr/bin/env sh

set -e
echo "Enter release version:"
read VERSION
read -p "Realeaing $VERSION - are you sure? (y/n)" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
 echo "Realeaing $VERSION ..."

 # commit
 git add -A
 git commit -m "[build] $VERSION"
 npm version $VERSION --message "[release] $VERSION"
 git push origin master

 # publish 发布到npm
 # 发布前需要在终端登录npm,即执行npm login,按照引导输入即可
 npm publish
fi

0
0

ustbhuangyi

2020-02-10

贴一下你的 release.sh 代码

0
3
慕少8034756
老师,我的问题已解决。总结如下: (1)每次提交的时候,必须要有改动,自动化部署脚本release.sh脚本中的git命令才能执行成功。 (2)需切换到npmjs源, npm config set registry https://registry.npmjs.org/
2020-02-10
共3条回复

下一代前端开发语言 TypeScript从零重构axios

课程从零开始重构功能完整的JS库,是学习造轮子的不二之选!

2629 学习 · 877 问题

查看课程