简体   繁体   English

升级npm和nodejs后如何修复npm软件包

[英]How to fix npm package after upgrading npm and nodejs

In this case i how to fix protractor . 在这种情况下,我该如何修理量角器

i have installed protractor v1.6.1 globally use npm v below 2 and node below 1. 我已经在全球范围内安装了量角器v1.6.1 ,请在2以下使用npm v,在1以下使用节点。

Along the way i update both npm and node , now i use npm v3.7.2 and node v4.2.6 . 在更新npmnode ,现在我使用npm v3.7.2node v4.2.6 As the protractor say about it's compatibility say i should use version 3, which match node v 4 . 正如量角器所说的兼容性,我应该使用版本3,它与node v 4相匹配。

i stupidly do delete manually the old protractor v1.6.1 when i install new protractor which is v3.1.1 it say located on 我愚蠢做手工删除旧的量角器v1.6.1当我安装新的量角器是v3.1.1它说位于

X:\nodejs
`-- protractor@3.1.1

but when i have to verify it's working, with protractor --version . 但是当我必须验证它是否正常时,可以使用protractor --version It yell like so : 像这样大喊:

Error cannot find module `X:\AppData\Roaming\npm\node_modules\protractor\bin\protractor
at ...

how to fix that? 如何解决? Thanks 谢谢

in case of protractor moving or delete these file just solve the problem if you configure npm , nodejs properly and install new protractor successfully. 如果量角器移动或删除这些文件,只需配置npmnodejs并成功安装新的protractornodejs解决问题。

X:\AppData\Roaming\npm\protractor
X:\AppData\Roaming\npm\protractor.md

for save i also move 为了节省,我也搬家

X:\AppData\Roaming\npm\webdriver-manager
X:\AppData\Roaming\npm\webdriver-manager.md

You can also choose to use npm which installed on the nodejs installation dir . 您还可以选择使用在nodejs installation dirnodejs installation dir npm。 For detail about doing that you can read more about it here (option 3). 有关执行此操作的详细信息,您可以在此处了解更多信息(选项3)。

For choosing the option you can prefer with the npm config prefix which currenly you use. 选择该选项时,您可以首选使用当前使用的npm config prefix To know about it run the following command : 要了解它,请运行以下命令:

npm config get prefix -g

i choose option 3 because currently my machine use 我选择选项3,因为当前我的机器使用

X:\nodejs

as it's prefix. 作为前缀。 For windows and troubleshooting related you can read here , and for npm config prefix itself you can read here 对于Windows和相关的故障排除,您可以在这里阅读,对于npm config前缀本身,您可以在这里阅读

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM