Vue環境搭建報錯整理大全
錯1: 執行 cnpm install / npm install 報錯如下
× Install fail! Error: [[email protected] › [email protected] › raphael@git+https://github.com/nhn/raphael.git#2.2.0-c] An unknown git error occurred Error: [[email protected] › [email protected] › raphael@git+https://github.com/nhn/raphael.git#2.2.0-c] An unknown git error occurred at module.exports (C:\Users\LMGD\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\download\git.js:36:11) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async module.exports (C:\Users\LMGD\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\download\index.js:17:12) at async _install (C:\Users\LMGD\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\install.js:125:16) at async install (C:\Users\LMGD\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\install.js:26:12) at async mapper (C:\Users\LMGD\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\install.js:266:9)
解決:
辦法1:降低node.js版本
1、開始以為是鏡像源連接不上,換成淘寶鏡像也不行。
2、node.js卸載多次,重新安裝也不行。百度的方法都試過也不行。最後最後最後,降低node.js版本,問題解決。
3、node.js 原本使用的版本是 node-v16.13.0-x64 卸載重新安裝 node-v12.9.0-x64 即可。(隻是解決瞭這個問題而已,其他問題還是需要百度)
辦法2:降低版本依舊報錯,執行相關命令
Error: [[email protected] › [email protected] › raphael@git+https://github.com/nhn/raphael.git#2.2.0-c] An unknown git error occurred at module.exports (C:\Users\LMGD\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\download\git.js:36:11) at processTicksAndRejections (internal/process/task_queues.js:85:5)
解決:執行如下命令即可
npm install cnpm -g --registry=https://registry.npm.taobao.org
效果截圖:
報錯2:core-js 缺失問題
npm install --save core-js/modules/es.regexp.dot-all.js core-js/modules/es.typed-array.at.js
解決:core-js 缺失問題,首先安裝core-js ;運行:npm install core-js@2
npm install core-js@2
報錯3: Connection was aborted, errno 10053
OpenSSL SSL_read: Connection was aborted, errno 10053
原因: Git默認限制推送的大小,運行命令更改限制大小即可
解決: 執行命令 :git config –global http.postBuffer 524288000
git config --global http.postBuffer 524288000
報錯4:npm ERR! [email protected]: Permission denied (publickey)
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://[email protected]/adobe-webplatform/eve.git npm ERR! npm ERR! [email protected]: 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.
解決:本地重新生成 publickey,然後在github上配置key即可
錯誤5:Error: Cannot find module 'webpack' 問題解決辦法
解決:沒找到webpack模塊,安裝webpack模塊,執行命令 npm install –save-dev webpack
npm install --save-dev webpack
錯誤6: [email protected] dev: `vue-cli-service serve`
解決:使用淘寶鏡像,執行如下命令即可
npm install cnpm -g --registry=https://registry.npm.taobao.org
錯誤7:Error: Cannot find module '@vue/cli-plugin-babel'
Error: Cannot find module '@vue/cli-plugin-babel' Require stack: - C:\Users\LMGD\AppData\Roaming\npm\node_modules\@vue\cli-service\lib\Service.js - C:\Users\LMGD\AppData\Roaming\npm\node_modules\@vue\cli-service\bin\vue-cli-service.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15) at Function.Module._load (internal/modules/cjs/loader.js:677:27) at Module.require (internal/modules/cjs/loader.js:830:19) at require (internal/modules/cjs/helpers.js:68:18) at idToPlugin (C:\Users\LMGD\AppData\Roaming\npm\node_modules\@vue\cli-service\lib\Service.js:145:14) at C:\Users\LMGD\AppData\Roaming\npm\node_modules\@vue\cli-service\lib\Service.js:184:20 at Array.map (<anonymous>) at Service.resolvePlugins (C:\Users\LMGD\AppData\Roaming\npm\node_modules\@vue\cli-service\lib\Service.js:170:10) at new Service (C:\Users\LMGD\AppData\Roaming\npm\node_modules\@vue\cli-service\lib\Service.js:32:25) at Object.<anonymous> (C:\Users\LMGD\AppData\Roaming\npm\node_modules\@vue\cli-service\bin\vue-cli-service.js:15:17) {
解決:缺少 @vue/cli-plugin-babel 安裝即可。執行命令:npm install @vue/cli-plugin-babel
npm install @vue/cli-plugin-babel
錯誤8:vue-cli · Failed to download repo vuejs-templates/webpack: read ECONNRESET
輸入初始化項目命令 vue init webpack xxx項目名; 後報錯 報錯信息: vue-cli · Failed to download repo vuejs-templates/webpack: read ECONNRESET
解決: 這是網絡問題,切換好一點的網絡即可解決;
切換網絡後的效果圖:
總結
到此這篇關於Vue環境搭建報錯整理的文章就介紹到這瞭,更多相關Vue環境搭建報錯內容請搜索WalkonNet以前的文章或繼續瀏覽下面的相關文章希望大傢以後多多支持WalkonNet!
推薦閱讀:
- vue在install時[email protected] postinstall:node scripts/build.js錯誤解決
- vue安裝less-loader依賴失敗問題及解決方案
- 詳解npm和cnpm混用的坑
- webpack搭建vue環境時報錯異常解決
- 使用webpack打包ts代碼的實現