如何修复:“路径"参数必须是字符串类型.运行“vue add vuetify"时收到的类型未定义 [英] How to fix: 'The "path" argument must be of type string. Received type undefined' when running 'vue add vuetify'

查看:56
本文介绍了如何修复:“路径"参数必须是字符串类型.运行“vue add vuetify"时收到的类型未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个带有vue create议程"的新应用,一切顺利.然后我进入项目文件夹并运行'vue add vuetify'将Vuetify添加到项目中并收到以下错误.

I've created a new app with 'vue create agenda', and it went alright. Then I cd into the project folder and run 'vue add vuetify' to add Vuetify into the project and receive the following error.

我已经搜索了错误,看看其他线程的任何其他答案是否会有所帮助,但没有一个对我有用.

I have already searched the error to see if any of the other answers to other threads would help, but none of them worked for me.

顺便说一句,大多数人建议更新节点.但是并没有解决问题.我曾尝试升级到 11.14.0 版,但在检查并发现它没有帮助后又回到了 10.15.3 版.

The majority suggested to update node btw. But it didnt solve the problem. I've tried to upgrade to version 11.14.0, but went back to version 10.15.3 after checking out and finding it didnt help.

我当前的版本:

vue --version3.6.1

vue --version 3.6.1

节点 -vv10.15.3

node -v v10.15.3

Installing vue-cli-plugin-vuetify...

 ERROR  TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Object.join (path.js:427:7)
    at exports.hasProjectPnpm (C:\Users\Gabriel\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\@vue\cli-shared-utils\lib\env.js:113:25)
    at add (C:\Users\Gabriel\AppData\Roaming\npm\node_modules\@vue\cli\lib\add.js:30:94)
    at module.exports.args (C:\Users\Gabriel\AppData\Roaming\npm\node_modules\@vue\cli\lib\add.js:66:10)
    at Command.program.command.description.option.allowUnknownOption.action (C:\Users\Gabriel\AppData\Roaming\npm\node_modules\@vue\cli\bin\vue.js:86:26)
    at Command.listener (C:\Users\Gabriel\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:189:13)
    at Command.parseArgs (C:\Users\Gabriel\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\commander\index.js:651:12)
    at Command.parse (C:\Users\Gabriel\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\commander\index.js:474:21)

预期的行为应该是将 vuetify 添加到项目中.

Expected behavior should be to just add vuetify to the project.

当前行为是上面的错误和消息.

Current behavior is the error and the message above.

推荐答案

这是一个已知问题 (vuejs/vue-cli#3804),最近在 v3.6.2.尝试重新安装 Vue CLI:

This is a known issue (vuejs/vue-cli#3804) that was fixed very recently in v3.6.2. Try reinstalling Vue CLI:

npm uninstall -g @vue/cli
npm install -g @vue/cli

如果重新安装不是一种选择,一种解决方法是安装 yarn,它允许 Vue CLI 短接有问题的代码.

If reinstalling is not an option, a workaround is to install yarn, which allows Vue CLI to short circuit the problematic code.

这篇关于如何修复:“路径"参数必须是字符串类型.运行“vue add vuetify"时收到的类型未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆