【问题标题】:error trying to install @babel/preset-env尝试安装 @babel/preset-env 时出错
【发布时间】:2019-10-19 07:36:14
【问题描述】:

我正在尝试在节点中安装@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

【问题讨论】:

    标签: node.js npm


    【解决方案1】:

    试试这些解决方案之一

    1. npm cache verify --force
    2. 删除packages-lock.json
    3. npm cache clean --force
    4. 删除node_modules

    【讨论】:

      【解决方案2】:

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

      1. rm -rf node_modules
      2. rm package-lock.json
      3. npm cache clean -f
      4. npm cache verify -f
      5. npm i

      这应该会删除您拥有的所有缓存数据,并强制 npm 访问注册表以获取新的包数据并重新生成您的 package-lock.json 以使用更新的完整性哈希。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-09-10
        • 1970-01-01
        • 2018-04-27
        • 2018-09-06
        • 1970-01-01
        • 2018-10-26
        • 1970-01-01
        相关资源
        最近更新 更多