创建vue3.0项目时报错: ERROR Error: spawn yarn ENOENT

创建vue3.0项目时报错: ERROR Error: spawn yarn ENOENT

Vue CLI v4.5.11
Failed to check for updates
  Creating project in /Users/xxx/Desktop/vue-3/vue3-demo.
  Initializing git repository...
  Installing CLI plugins. This might take a while...

ERROR  Error: spawn yarn ENOENT
Error: spawn yarn ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
    at onErrorNT (internal/child_process.js:470:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
以上报错为未安装yarn,全局安装yarn: npm install -g yarn

再次创建项目仍然报错: ERROR command failed: yarn

error An unexpected error occurred: "https://registry.npm.taobao.org/rxjs/download/rxjs-6.6.3.tgz?cache=0&sync_timestamp=1610927656674&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Frxjs%2Fdownload%2Frxjs-6.6.3.tgz: ESOCKETTIMEDOUT".
info If you think this is a bug, please open a bug report with the information provided in "/Users/xxx/Desktop/vue-3/vue3-demo/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
ERROR  command failed: yarn 

以上报错为安装镜像需要调整,此时进行安装nrm进行镜像的管理

npm install -g nrm  全局安装nrm
nrm -V 查看版本号,是否安装成功
nrm ls 查看可用的镜像
nrm use npm/cnpm/yarn...   切换镜像源

因为安装vue3.0项目一直报错,使用yarn也无法成功,
则切换为npm安装,nrm use npm
再次新建Vue项目 vue create my-project 自行安装

猜你喜欢

转载自blog.csdn.net/amy1019/article/details/113694441