Error: Target directory already exists

Hello,

I can’t get around this problem. When I try to create a new vapid project using ‘vapid new /path’ I get the following error.

C:\Users\USER\AppData\Roaming\npm\node_modules\@vapid\cli\lib\generator.js:24
      throw new Boom('Target directory already exists.');
      ^

Error: Target directory already exists.
    at Function.copyTo (C:\Users\USER\AppData\Roaming\npm\node_modules\@vapid\cli\lib\generator.js:24:13)
    at Command.<anonymous> (C:\Users\USER\AppData\Roaming\npm\node_modules\@vapid\cli\bin\cli.js:41:15)
    at Command.listener (C:\Users\USER\AppData\Roaming\npm\node_modules\@vapid\cli\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:315:20)
    at Command.parseArgs (C:\Users\USER\AppData\Roaming\npm\node_modules\@vapid\cli\node_modules\commander\index.js:651:12)
    at Command.parse (C:\Users\USER\AppData\Roaming\npm\node_modules\@vapid\cli\node_modules\commander\index.js:474:21)
    at Object.<anonymous> (C:\Users\USER\AppData\Roaming\npm\node_modules\@vapid\cli\bin\cli.js:122:11)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  data: null,
  isBoom: true,
  isServer: true,
  output: {
    statusCode: 500,
    payload: {
      statusCode: 500,
      error: 'Internal Server Error',
      message: 'An internal server error occurred'
    },
    headers: {}
  }
}

I’ve tried uninstalling and reinstalling Vapid and when that didn’t work I uninstalled and reinstalled Node and npm. This didn’t help either. I’ve tried to run ‘vapid new /path’ at different paths but it gives this error every time.

Please Help.

So that took a while but I finally figured it out. When you create a new Vapid project you must do it onto a new directory. ex. ‘vapid new /path/to/new/folder’

The error was coming from the fact that I was trying to run ‘vapid new .’ every damn time.

2 Likes