前端问题汇总(我是小白)

  • Post author:
  • Post category:其他

安装报错:

npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/eligrey/FileSaver.js.git
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

网上解决方案1:

npm cache clean --force

———————————————————————————————————————————

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: copy-webpack-plugin@9.0.1
npm ERR! Found: webpack@3.12.0
npm ERR! node_modules/webpack
npm ERR!   dev webpack@"3.12.0" from the root project
npm ERR!   peer webpack@"2 || 3 || 4" from babel-loader@7.1.5
npm ERR!   node_modules/babel-loader
npm ERR!     dev babel-loader@"^7.1.2" from the root project
npm ERR!   9 more (file-loader, friendly-errors-webpack-plugin, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^5.1.0" from copy-webpack-plugin@9.0.1
npm ERR! node_modules/copy-webpack-plugin
npm ERR!   dev copy-webpack-plugin@"^9.0.1" from the root project
npm ERR!
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^5.1.0" from copy-webpack-plugin@9.0.1
npm ERR!   node_modules/copy-webpack-plugin
npm ERR!     dev copy-webpack-plugin@"^9.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Administrator\AppData\Local\npm-cache\eresolve-report.txt for a full report.

解决方案

看了好多,大概是npm版本太高的问题;

ERESOLVE与npm@7有关的问题很常见,因为npm7.x对某些事情比npm6.x更严格。通常,最简单的解决方法是将–legacy-peer-deps标志传递给npm(e.g.,npm i –legacy-peer-deps),或者使用npm@6。

如果这不能立即起作用,也许可以先删除node_modules和package-lock.json。它们将被重新创建。

降级npm到6版本

使用npx指定npm的版本

npx -p npm@6 npm i --legacy-peer-deps
  1. 降级
    举例:降级到4
    npm install npm@4 -g(@后跟版本号,若跟的是大版本,则更新到对应大版本最新的小版本)
    npm install npm@4.1.2 -g(更新到指定版本)

  2. 升级
    npm install npm -g(更新到最新版本

—————————————————————————————————————————–

npm ERR! Windows_NT 10.0.18363
npm ERR! argv "E:\\nodejs\\node.exe" "C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i"
npm ERR! node v14.17.6
npm ERR! npm  v3.10.10

npm ERR! cb.apply is not a function
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

试了好多次

1.执行
npm config get proxy

npm config get https-proxy

2、如果返回值不为null,继续执行

npm config set proxy null

npm config set https-proxy null

3、执行

npm config set registry http://registry.cnpmjs.org/

都不行,重新安装vscode 可以了

—————————————————————————————————————————–

每次安装执行到这里都报错 


4796 silly fetchPackageMetaData error for file-saver@github:eligrey/FileSaver.js#1.3.8 Error while executing:

4796 silly fetchPackageMetaData E:\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git

4796 silly fetchPackageMetaData

4796 silly fetchPackageMetaData ssh: connect to host ssh.github.com port 443: Connection timed out

4796 silly fetchPackageMetaData fatal: Could not read from remote repository.

4796 silly fetchPackageMetaData

4796 silly fetchPackageMetaData Please make sure you have the correct access rights

4796 silly fetchPackageMetaData and the repository exists.

4796 silly fetchPackageMetaData

4796 silly fetchPackageMetaData exited with error code: 128

解决方法

git config --global http.sslVerify "false"
(可能每次都得执行)

版权声明:本文为woniu963原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。