美文网首页
vue install 异常记录

vue install 异常记录

作者: 漫画三毛 | 来源:发表于2022-01-18 15:33 被阅读0次

    1. canvas安装异常

    3801 verbose stack Error: command failed
    3801 verbose stack     at ChildProcess.<anonymous> (H:\tools\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
    3801 verbose stack     at ChildProcess.emit (node:events:390:28)
    3801 verbose stack     at maybeClose (node:internal/child_process:1064:16)
    3801 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
    3802 verbose pkgid canvas@2.8.0
    3803 verbose cwd E:\workspaces\\web-3.2.7
    3804 verbose Windows_NT 10.0.19043
    3805 verbose argv "H:\\tools\\nodejs\\node.exe" "H:\\tools\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--scripts-prepend-node-path=auto"
    3806 verbose node v16.13.0
    3807 verbose npm  v8.1.0
    3808 error code 1
    3809 error path E:\workspaces\web-3.2.7\node_modules\canvas
    3810 error command failed
    3811 error command C:\WINDOWS\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
    
    解决思路:

    尝试使用下面命令单独安装

    npm install --save canvas --canvas_binary_host_mirror=https://npm.taobao.org/mirrors/node-canvas-prebuilt/
    

    如果这样也不能成功,可考虑简单粗暴的方法,参考文件如下:

    原文地址:https://blog.csdn.net/stardtx/article/details/123847366

    1、从网上下载项目所需canvas的版本,下载地址: https://github.com/Automattic/node-canvas/releases
    2、将文件解压缩放入到项目依赖包的目录\node_modules\canvas\build
    注意: 如果node_modules无canvas目录,可进行一下步骤

    • npm install ,等待canvas目录出现,结束安装;
    • 解压文件到canvas\build;
    • 再次npm install。

    2. 安装第三包(npm install)时报错

    原文地址:https://www.cnblogs.com/clis/p/15965188.html

    主要报错信息:ls-remote ssh://git@github.com/adobe-webplatform/eve.git

    npm ERR! code 128
    npm ERR! git dep preparation failed
    npm ERR! command D:\nodejs\node.exe D:\nvm\v16.14.0\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
    npm ERR! npm WARN using --force Recommended protections disabled.
    npm ERR! npm ERR! code 128
    npm ERR! npm ERR! A git connection error occurred
    npm ERR! npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/adobe-webplatform/eve.git
    npm ERR! npm ERR! kex_exchange_identification: read: Connection reset by peer
    npm ERR! npm ERR! Connection reset by 20.205.243.166 port 22
    npm ERR! npm ERR! fatal: Could not read from remote repository.
    npm ERR! npm ERR!
    npm ERR! npm ERR! Please make sure you have the correct access rights
    npm ERR! npm ERR! and the repository exists.
    npm ERR!
    npm ERR! npm ERR! A complete log of this run can be found in:
    npm ERR! npm ERR!     C:\Users\AppData\Local\npm-cache\_logs\2022-03-04T08_29_17_072Z-debug-0.log072Z-debug-0.log
    
    npm ERR! A complete log of this run can be found in:                                      g-0.log
    npm ERR!     C:\Users\AppData\Local\npm-cache\_logs\2022-03-04T08_27_27_482Z-debug-0.log
    
    
    解决方案1

    修改Git的协议(ssh 替换为 https)

    git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"
    
    

    如果电脑能正常访问 github 是没有问题的,但是偶尔失败还是正常的。
    装个 fastgithub 并运行可以解决
    fastgithub 使用说明:https://zhuanlan.zhihu.com/p/428454772
    fastgithub 下载地址:https://github.com/dotnetcore/fastgithub/releases

    这样基本上就不会有什么问题了。

    解决方案2

    这里再提供一个镜像网站的方案:

    git config --global url."https://hub.fastgit.xyz/".insteadOf "ssh://git@github.com/"
    

    3. Could not read from remote repository ssh://git@github.com/

    解决方案参考:https://blog.csdn.net/weixin_40922744/article/details/107576748

    npm ERR! code 128
    npm ERR! git dep preparation failed
    npm ERR! command H:\Program Files\nodejs\node.exe G:\appcache\nodejs\node_global\node_modules\npm\bin\npm-cli.js install --force --cache=G:\appcache\nodejs\node_cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
    npm ERR! npm WARN using --force Recommended protections disabled.
    npm ERR! npm ERR! code 128
    npm ERR! npm ERR! An unknown git error occurred
    npm ERR! npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/adobe-webplatform/eve.git
    npm ERR! npm ERR! git@github.com: Permission denied (publickey).
    npm ERR! npm ERR! fatal: Could not read from remote repository.
    npm ERR! npm ERR!
    npm ERR! npm ERR! Please make sure you have the correct access rights
    npm ERR! npm ERR! and the repository exists.
    npm ERR!
    npm ERR! npm ERR! A complete log of this run can be found in:
    npm ERR! npm ERR!     G:\appcache\nodejs\node_cache\_logs\2022-04-15T04_00_10_443Z-debug.log
    
    

    相关文章

      网友评论

          本文标题:vue install 异常记录

          本文链接:https://www.haomeiwen.com/subject/zcvkhrtx.html