Node.js 尝试安装@babel/preset env时出错

Node.js 尝试安装@babel/preset env时出错,node.js,npm,Node.js,Npm,我试图在节点中安装@babel/preset env,我得到了以下问题 npm install @babel/preset-env --save-dev npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha512-PMnY0yhKljgjrP3jQNP5C9slQM//bCLO4ZRr9gmo+2mLkVhCIxhT3A9grgblgL

我试图在节点中安装@babel/preset env,我得到了以下问题

npm install @babel/preset-env --save-dev
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha512-PMnY0yhKljgjrP3jQNP5C9slQM//bCLO4ZRr9gmo+2mLkVhCIxhT3A9grgblgLXmOPVd6GFzeIEA6/0g99cxDA== integrity checksum failed when
using sha512: wanted sha512-PMnY0yhKljgjrP3jQNP5C9slQM//bCLO4ZRr9gmo+2mLkVhCIxhT3A9grgblgLXmOPVd6GFzeIEA6/0g99cxDA== but got sha512-IU+YnDh7WJASsz892TYz1eQ+vaEypoAPLmu6DO2Uw2NZzfl/F2ypEL3xrEiIXLU8Buok1TujSujt3bLMmUmysg==. (34788 bytes)
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code EINTEGRITY
npm ERR! errno EINTEGRITY
npm ERR! Invalid response body while trying to fetch https://registry.npmjs.org/@babel%2fplugin-transform-member-expression-literals: Integrity verification failed for sha512-PMnY0yhKljgjrP3jQNP5C9slQM//bCLO4ZRr9gmo+2mLkVhCIxhT3A9grgblgLXmOPVd6GFzeIEA6/0g99cxDA== (C:\Users\PRO\AppData\Roaming\npm-cache\_cacache\content-v2\sha512\3c\c9\d8d3284a963823acfde340d3f90bdb2540cfff6c22cee1946bf609a8fb698b915842231853dc0f60ae06e580b5e638f55de86173788100ebfd20f7d7310c)
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\PRO\AppData\Roaming\npm-cache\_logs\2019-10-18T22_56_31_231Z-debug.log

试试这些解决方案

  • npm缓存验证——强制执行
  • 删除
    包锁.json
  • npm缓存清理--强制执行
  • 删除节点模块

  • 通常,这意味着您的本地npm缓存或package-lock.json已损坏,导致npm注册表中的
    @babel/preset env
    完整性哈希与
    package-lock.json
    中的不同。我会按照这个顺序做这些步骤

  • rm-rf节点模块
  • rm package lock.json
  • npm缓存清理-f
  • npm缓存验证-f
  • npm i
  • 这将删除您拥有的所有缓存数据,并强制npm访问注册表以获取新的包数据,并重新生成您的
    包锁.json
    以使用更新的完整性哈希