-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: cnpm install error without user settings #301
Conversation
Codecov Report
@@ Coverage Diff @@
## master #301 +/- ##
==========================================
+ Coverage 92.99% 92.99% +<.01%
==========================================
Files 29 29
Lines 2026 2027 +1
Branches 349 350 +1
==========================================
+ Hits 1884 1885 +1
Misses 142 142
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #301 +/- ##
==========================================
+ Coverage 92.99% 92.99% +<.01%
==========================================
Files 29 29
Lines 2026 2027 +1
Branches 349 350 +1
==========================================
+ Hits 1884 1885 +1
Misses 142 142
Continue to review full report at Codecov.
|
大概是这个意思,对写测试用例不是很熟悉,希望指正。 |
我试了下 cnpm 指定这个带上 auth 的 npminstall,安装模块并不会有错误,你的错误复现条件可以描述下么? |
嗯嗯,刚才确认了是部分情况下才会有问题。 复现步骤:
|
@Moudicat OK,明白了,相当于设置了 registry 但是没有登录,会被判断为需要携带 Auth 信息导致出错 |
cnpm 也打算带上鉴权信息的话,后面可以考虑移植 npm-cli 那边的对应逻辑 @fengmk2 . |
@hyj1991 可以合并? |
@Moudicat 测试用例使用 coffee 来跑,新起进程的方式,就不需要这样 hack require cache 实现了。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
好的 |
yield coffee.fork(npminstall, ['webpack-parallel-uglify-plugin@1.0.0'], { | ||
cwd: cwd, | ||
env: Object.assign({}, process.env, { | ||
NODE: cwd, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个不需要设置吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,现在保留 USERPROFILE
和 HOME
3.21.1 |
根据 PR #259 来看,如果用户新装cnpm、指定过registry、且未登录的情况,会导致安装报错。
现先判断是否有用户登录数据再做处理。