Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix: 'The "path" argument must be of type string. Received type undefined' when running 'vue add 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.

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.

My current versions:

vue --version 3.6.1

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)

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

Current behavior is the error and the message above.

like image 752
Gabriel Kojima Avatar asked Apr 15 '19 23:04

Gabriel Kojima


1 Answers

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

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

like image 170
tony19 Avatar answered Oct 18 '22 22:10

tony19