V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
SekiBetu
V2EX  ›  Node.js

这个警告是 npm 的问题吗? The package-lock.json file was created with an old version of npm

  •  
  •   SekiBetu · 2021-10-17 11:02:18 +08:00 · 8055 次点击
    这是一个创建于 893 天前的主题,其中的信息可能已经有所发展或是发生改变。
    > npm update
    
    npm WARN old lockfile
    npm WARN old lockfile The package-lock.json file was created with an old version of npm,
    npm WARN old lockfile so supplemental metadata must be fetched from the registry.
    npm WARN old lockfile
    npm WARN old lockfile This is a one-time fix-up, please be patient...
    npm WARN old lockfile
    npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
    
    up to date in 11s
    
    1 package is looking for funding
      run `npm fund` for details
    

    搜寻了很多解决方法但是一个都没奏效,虽然不影响使用,但是我用的一直是最新版的 npm 啊,总是提示我 package-lock.json 是旧版创建的,删除 node_modulespackage-lock.json 重新生成后也还是提示这个

    8 条回复    2022-01-26 20:19:55 +08:00
    SoloCompany
        2
    SoloCompany  
       2021-10-17 15:53:09 +08:00
    +1

    那个 so 其实并没有太大帮助, 除了降级到 npm6 似乎没有任何办法, 试过很多都不行
    IvanLi127
        3
    IvanLi127  
       2021-10-17 18:03:36 +08:00 via Android
    我更新过 npm 后,装依赖会有这个提示,不过提示一次后就不会再出现了。
    SekiBetu
        4
    SekiBetu  
    OP
       2021-10-18 00:06:31 +08:00
    @Procumbens 所以就是因为 npm 的版本不符合 node 的对应版本是吧,只有和 node 一起 release 的那个 npm 版本才能避免这个提示?
    JerryCha
        5
    JerryCha  
       2021-10-18 10:19:50 +08:00
    删掉重新跑一次 install 能解决问题。主要是 package-lock 文件随着 npm 安全机制提升进行过一次升级。
    SekiBetu
        6
    SekiBetu  
    OP
       2021-10-27 14:00:37 +08:00
    已经解决了,nodejs16 版本进入 LTS 了,升级了之后不再出现了,应该是 npm 必须和 nodejs 配套一起 release 的那个大版本号才会不出现警告,nodejs14 必须和 npm6 ,nodejs16 必须和 npm8 ,如果 nodejs 和未来的 npm9 一起的话也会报错
    liaohongxing
        7
    liaohongxing  
       2022-01-11 14:14:31 +08:00
    你需要删除 package-lock.json ,都 lock 了 。npm update 坑定不行, 至于这个 package-lock.json 在那里,那要问你了
    SekiBetu
        8
    SekiBetu  
    OP
       2022-01-26 20:19:55 +08:00
    @liaohongxing 我觉得你还是仔细阅读我每一句话比较好, "删除 node_modules 和 package-lock.json 重新生成后也还是提示这个"
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3092 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 12:53 · PVG 20:53 · LAX 05:53 · JFK 08:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.