-
Notifications
You must be signed in to change notification settings - Fork 250
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
使用私有的npm仓库,当我使用nrm use xxx时,报错 customRegistries.hasOwnProperty is not a function, v1.2.1 #74
Comments
mark |
https://github.com/npm/ini/blob/master/ini.js#L86 不关 nrm 的事情,是依赖 ini.js 作的妖…… |
怎么解决呀亲? |
可以先手动修改代码简单粗暴解决一下。 return fs.existsSync(NRMRC) ? JSON.parse(JSON.stringify(ini.parse(fs.readFileSync(NRMRC, 'utf-8')))) : {}; |
这个问题其实多少和nrm源码严谨度有关系,判断一个属性是否为对象的自有属性,不应该直接在对象上调用一般默认继承的hasOwnProperty方法。 错误示范: var allRegistries = getAllRegistry();
if (allRegistries.hasOwnProperty(name)) {
// ...
} 正确示范: var allRegistries = getAllRegistry();
if (Object.prototype.hasOwnProperty.call(allRegistries, name)) {
// ...
} |
@marklbp 感谢,已经修改了这个问题 |
No description provided.
The text was updated successfully, but these errors were encountered: