如何修复:'The "path" argument must be of type string. Received type undefined' 当 运行 'vue add vuetify'

How to fix: 'The "path" argument must be of type string. Received type undefined' when running 'vue add vuetify'

我用 'vue create agenda' 创建了一个新应用,一切顺利。然后我 cd 到项目文件夹和 运行 'vue add vuetify' 将 Vuetify 添加到项目中并收到以下错误。

我已经搜索了错误以查看对其他线程的任何其他答案是否有帮助,但是 none 对我有用。

大多数人建议顺便更新节点。但这并没有解决问题。我尝试升级到 11.14.0 版本,但在检查后发现它没有帮助。

我当前的版本:

vue --版本 3.6.1

节点-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 添加到项目中。

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

这是一个已知问题(vuejs/vue-cli#3804) that was fixed very recently in v3.6.2。尝试重新安装 Vue CLI:

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

如果无法重新安装,解决方法是安装 yarn,这允许 Vue CLI short circuit the problematic code