我正在尝试在Ubuntu中使用Vue CLI创建Vue项目,但仍然会出现相同的错误。我已经使用sudo npm i -g @vue/cli
安装了Vue CLI。
这是错误消息:
00h00m00s 0/0 ::错误错误:命令失败:yarn config获取注册表 错误:[错误2]没有这样的文件或目录:'config'
错误:命令失败:yarn配置获取注册表
错误:[错误2]没有此类文件或目录:“ config”
在makeError(/usr/local/lib/node_modules/@vue/cli/node_modules/execa/index.js:174:9) 在Promise.all.then.arr(/usr/local/lib/node_modules/@vue/cli/node_modules/execa/index.js:278:16) 在processTicksAndRejections(internal / process / next_tick.js:81:5)
这是什么原因?
答案 0 :(得分:2)
根据error
,它正在尝试在node_modules
中查找yarn的配置文件。我相信您的系统中没有安装yarn
packageManager
尝试一下
vue config -s packageManager npm
然后重新运行vue create
答案 1 :(得分:1)
a)卸载yarn,以便create退回到npm
b)明确告诉它使用npm:
vue create myproject --packageManager npm
答案 2 :(得分:0)
卸载 node 和 npm,然后重新启动我的电脑,然后重新安装它们对我有用。
sudo apt remove nodejs
sudo apt autoremove
重新安装
sudo apt install nodejs
sudo apt install npm