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

每次执行 npm ci 都报错,但是执行 npm install 就不报错

  •  
  •   bologer · 2019-12-30 16:40:19 +08:00 · 4206 次点击
    这是一个创建于 1788 天前的主题,其中的信息可能已经有所发展或是发生改变。

    看到大家说 npm cinpm install 运行速度快,但是需要目录下有 package-lock.json 但是执行了 npm ci 却报错如下:

    > [email protected] install D:\a_git_working\smartcampus_pc\office\node_modules\fsevents
    > node-gyp rebuild
    
    
    D:\a_git_working\smartcampus_pc\office\node_modules\fsevents>if not defined npm_config_node_gyp (node "D:\Diesel.Program\nvm\v10.17.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "D:\Diesel.Program\nvm\v10.17.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
    Traceback (most recent call last):
      File "D:\Diesel.Program\nvm\v10.17.0\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, in <module>
        sys.exit(gyp.script_main())
      File "D:\Diesel.Program\nvm\v10.17.0\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 554, in script_main
        return main(sys.argv[1:])
      File "D:\Diesel.Program\nvm\v10.17.0\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 547, in main
        return gyp_main(args)
      File "D:\Diesel.Program\nvm\v10.17.0\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 532, in gyp_main
        generator.GenerateOutput(flat_list, targets, data, params)
      File "D:\Diesel.Program\nvm\v10.17.0\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2024, in GenerateOutput
        sln_projects, project_objects, flat=msvs_version.FlatSolution())
      File "D:\Diesel.Program\nvm\v10.17.0\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1781, in _GatherSolutionFolders
        return _DictsToFolders('', root, flat)
      File "D:\Diesel.Program\nvm\v10.17.0\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1734, in _DictsToFolders
        for folder, contents in bucket.items():
    AttributeError: 'MSVSProject' object has no attribute 'items'
    gyp ERR! configure error
    gyp ERR! stack Error: `gyp` failed with exit code: 1
    gyp ERR! stack     at ChildProcess.onCpExit (D:\Diesel.Program\nvm\v10.17.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:344:16)
    gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
    gyp ERR! System Windows_NT 10.0.18362
    gyp ERR! command "D:\\Diesel.Program\\nodejs\\node.exe" "D:\\Diesel.Program\\nvm\\v10.17.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
    gyp ERR! cwd D:\a_git_working\smartcampus_pc\office\node_modules\fsevents
    gyp ERR! node -v v10.17.0
    gyp ERR! node-gyp -v v5.0.3
    gyp ERR! not ok
    
    5 条回复    2020-12-21 10:32:07 +08:00
    jinliming2
        1
    jinliming2  
       2019-12-30 17:00:25 +08:00 via iPhone
    你这个是触发了 fsevents 的重新编译安装,windows 下是需要安装 python 和 visual studio build tools 的,并且你依赖的这个 fsevents 版本有点太低,新版环境( node、python、vs build tools )不一定能编译通过……
    bologer
        2
    bologer  
    OP
       2019-12-31 09:48:26 +08:00
    @jinliming2 那么在满足 win 下有 python 和 vabt 的情况下, 升级一下 fsevents 就可以了是吧?
    lihongjie0209
        3
    lihongjie0209  
       2019-12-31 10:17:19 +08:00
    直接用 yarn 吧, 和 npm 可以并存, 速度也快
    bologer
        4
    bologer  
    OP
       2019-12-31 14:26:22 +08:00
    @lihongjie0209 主要是 10 几人团队在用,而且有些在外地,换的话成本太大
    liuliangsir
        5
    liuliangsir  
       2020-12-21 10:32:07 +08:00
    遇到相同的问题,最后是如何解决的呢?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3147 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:24 · PVG 20:24 · LAX 04:24 · JFK 07:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.