Skip to content

vue-cli – cannot build for development mode

I have a .env file in my project



    "name": "my-website",
    "version": "0.1.0",
    "scripts": {
      "serve": "vue-cli-service serve",
      "build": "vue-cli-service build --mode development",
      "lint": "vue-cli-service lint"

When I run npm run build for the first time, it works.

When I run it after that, it shows error:

[email protected] build: `vue-cli-service build --mode development`

When I dig into the logs

13 verbose stack Error: [email protected] build: `vue-cli-service build --mode development`
13 verbose stack Exit status 1

After I delete the public folder, it suddenly works


After I update the outputDir from public to build, it works.


module.exports = {
  outputDir : 'build',