weixin_40335946 2019-03-18 22:06 采纳率: 0%
浏览 2806

npm 出现 fatal error C1083: 无法打开包括文件

_canvas@1.6.13@canvas\src\canvas.h(19): fatal error C1083: 无法打开包括文件: “cairo.h”: No such file or directory (编译源文件 ..\src\ImageData.cc)
有没有人给支个招啊

\ [21/22] Installing nan@^2.10.0gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\xiaojian\AppData\Roaming\npm\node_modules\cnpm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "F:\Program Files\nodejs\node.exe" "C:\Users\xiaojian\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\node-gyp-bin\node-gyp.js" "rebuild"
gyp ERR! cwd H:\项目\egg\node_modules_canvas@1.6.13@canvas
gyp ERR! node -v v10.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
[npminstall:runscript:error] canvas@^1.6.11 has binding.gyp file, run "node-gyp rebuild" error: Error: Run "C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild" error, exit code 1
× Install fail! Error: Run "C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild" error, exit code 1
Error: Run "C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild" error, exit code 1
at ChildProcess.proc.on.code (C:\Users\xiaojian\AppData\Roaming\npm\node_modules\cnpm\node_modules\runscript\index.js:74:21)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
npminstall version: 3.20.1
npminstall args: F:\Program Files\nodejs\node.exe C:\Users\xiaojian\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\xiaojian.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://registry.npm.taobao.org

  • 写回答

1条回答 默认 最新

  • 你知我知皆知 2024-08-08 09:44
    关注

    以下回答参考 皆我百晓生券券喵儿 等免费微信小程序相关内容作答,并由本人整理回复。

    这个问题是由于在安装依赖项时出现了错误。要解决这个问题,您可以尝试以下步骤:

    1. 清除缓存:首先,请确保您已经清理了缓存,这可以通过运行 npm cache clean --force 来完成。

    2. 重新安装依赖项:然后,请再次运行 npm install 命令来重新安装所需的依赖项。

    3. 检查是否已更新到最新版本:如果您使用的是npm 6或更高版本,请检查是否有可用的更新。可以使用以下命令来查找最近的可更新版本:

      npm outdated
      
    4. 更新依赖项的包管理器配置:如果您的系统上没有安装最新的Node.js和npm版本,或者您的环境变量中包含错误,那么可能需要更新这些工具。

    5. 如果以上方法都不能解决问题,建议联系npm团队寻求帮助。他们通常会在GitHub上提供详细的解决方案。

    请注意,在进行任何更改之前,最好先备份您的工作区以防万一。

    评论

报告相同问题?