@
目录最终解决方案为:使用cnpm下载vue-cli,下面是我的问题和解决方法,可以供你借鉴
起初安装过程中报错为这个
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: The API has been removed from Apollo Server 3. Use the plugin API instead: https://www.apollographql.com/docs/apollo-server/integrations/plugins/
npm WARN deprecated @hapi/[email protected]: Moved to 'npm install @sideway/address'
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated @hapi/[email protected]: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/[email protected]: Switch to 'npm install joi'
npm WARN deprecated [email protected]: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as @graphql-tools/schema, @graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead
npm ERR! code 1
npm ERR! path C:\Users\炳烛夜已深\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\utf-8-validate
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - executable path is "C:\Users\����ҹ����\AppData\Local\Programs\Python\Python37\python.exe"
npm ERR! gyp ERR! find Python - "C:\Users\����ҹ����\AppData\Local\Programs\Python\Python37\python.exe" could not be runnpm ERR! gyp ERR! find Python checking if "python2" can be used
npm ERR! gyp ERR! find Python - "python2" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if Python is C:\Python37\python.exe
npm ERR! gyp ERR! find Python - "C:\Python37\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if Python is C:\Python27\python.exe
npm ERR! gyp ERR! find Python - "C:\Python27\python.exe" could not be run
npm ERR! gyp ERR! find Python checking if the py launcher can be used to find Python
npm ERR! gyp ERR! find Python - executable path is "C:\Users\����ҹ����\AppData\Local\Programs\Python\Python37\python.exe"
npm ERR! gyp ERR! find Python - "C:\Users\����ҹ����\AppData\Local\Programs\Python\Python37\python.exe" could not be runnpm ERR! gyp ERR! find Python
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python npm config set python "C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack at PythonFinder.fail (D:\SoftWare\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:302:47)
npm ERR! gyp ERR! stack at PythonFinder.runChecks (D:\SoftWare\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (D:\SoftWare\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:220:16)
npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (D:\SoftWare\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:266:16)
npm ERR! gyp ERR! stack at exithandler (node:child_process:333:5)
npm ERR! gyp ERR! stack at ChildProcess.errorhandler (node:child_process:345:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:369:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
npm ERR! gyp ERR! stack at one rrorNT (node:internal/child_process:480:16)
npm ERR! gyp ERR! stack at processTicksAndRejections (node:internal/process/task_queues:81:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "D:\\SoftWare\\nodejs\\node.exe" "D:\\SoftWare\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\炳烛夜已深\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\utf-8-validate
npm ERR! gyp ERR! node -v v15.12.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\炳烛夜已深\AppData\Local\npm-cache\_logs\2021-09-28T01_50_54_201Z-debug.log
C:\Users\炳烛夜已深>npm config set strict-ssl false
C:\Users\炳烛夜已深>npm config set strict-ssl true
C:\Users\炳烛夜已深>npm install -g @vue/cli
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! request to https://registry.npm.taobao.org/loglevel failed, reason: Socket timeout
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\炳烛夜已深\AppData\Local\npm-cache\_logs\2021-09-28T01_53_39_921Z-debug.log
有说设置一下
npm config set strict-ssl false // 就可以啦
不过还是报这样的错误,于是我重新设置回来
npm config set strict-ssl true
再次下载,错误如下:
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! request to https://registry.npm.taobao.org/loglevel failed, reason: Socket timeout
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\炳烛夜已深\AppData\Local\npm-cache\_logs\2021-09-28T01_53_39_921Z-debug.log
npm ERR! request to https://registry.npm.taobao.org/loglevel failed, reason: Socket timeout
主要原因就是:请求https://registry.npm.taobao.org/loglevel失败
原因找到啦,请求淘宝npm包镜像地址失败,因为我本人使用nrm,切换了npm下载包的镜像地址
C:\Users\炳烛夜已深>nrm ls
npm -------- https://registry.npmjs.org/
yarn ------- https://registry.yarnpkg.com/
cnpm ------- http://r.cnpmjs.org/
* taobao ----- https://registry.npm.taobao.org/
nj --------- https://registry.nodejitsu.com/
npmMirror -- https://skimdb.npmjs.com/registry/
edunpm ----- http://registry.enpmjs.org/
看到这个错误原因,结合我在百度查找解决下载vue-cli的方法看到的一些方案,使用cnpm镜像网址下载vue-cli好像成功率更好,于是我果断切换npm下载包的镜像地址
nrm use cnpm
再次下载vue-cli
npm install -g @vue/cli
(虽然警告有很多,但是)下载成功
记录一下日常bug的解决方案,早知道就使用cnpm镜像地址下载啦
关于nrm的使用,大家可以看我的这个: nrm的安装与使用
希望这篇笔记能够帮助到你