首页 > 解决方案 > nativescript - 提取 tns-android 时验证失败

问题描述

这是我得到的错误!我不知道下一步该怎么做!

$ tns platform add android
Copying template files...
Verification failed while extracting tns-android@6.4.1:
sha512-gPHZi4EA+f39jvJRt5DTSA19Yk0jPAeWWxABd26GUbEU43i1ISnIg0/en42MeWaUjHDXk1Fc1hPXWbIcoEjKiQ== integrity checksum failed when using sha512: wanted sha512-gPHZi4EA+f39jvJRt5DTSA19Yk0jPAeWWxABd26GUbEU43i1ISnIg0/en42MeWaUjHDXk1Fc1hPXWbIcoEjKiQ== but got sha512-AfBUS4i8o0XL1i9MWw0eYhjeM1UW8KOXUbyGInhdPmpytri11XZsPBPE2ToNavy1ljo/rTw3/NBzpD5UP09Llg==. (7416194 bytes)

我还手动更改了 package.json 中的版本,这发生了:

Verification failed while extracting tns-android@6.5.0:
sha512-L7vxid4dSGD6CRS9I2HXCeovuSnChCPNmgmScv5K2qIAOLwcPHcQ77oI3gqEWzMIcNDYjmVFGDR0qjzaKxmydw== integrity checksum failed when using sha512: wanted sha512-L7vxid4dSGD6CRS9I2HXCeovuSnChCPNmgmScv5K2qIAOLwcPHcQ77oI3gqEWzMIcNDYjmVFGDR0qjzaKxmydw== but got sha512-pleOzs6WMvCDiueDSYDy4NQ1e2eTJmSUEAZqAnIjdW/Fp5qpBf/WRAwOPrg7aMl9Zgi4Eyb+CkSpVFN+cJ/kfg==. (9054579 bytes)

清除缓存并删除platformsnode_modules目录有效,但是当我尝试清除时我得到了这个,npm cache为什么--force

$ npm cache clean        
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
npm ERR! 
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.

标签: androidnpmnativescript

解决方案


尝试使用 nativescript 6.5.0 更新您的项目。

1.使用此命令更新nativescript:-

npm install -g nativescript

2.如果您的代码未使用 nativescript 6 迁移,请使用以下命令:-

tns migrate

3.更新您的项目 node_modules 和 tns_core_modules 后:-

tns update

4.添加平台

tns platform add android

推荐阅读