Home > OS >  vue-cli - cannot build for development mode
vue-cli - cannot build for development mode

Time:11-16

I have a .env file in my project

-public
-src
-.env.development.local

package.json

{
    "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:

my-website@0.1.0 build: `vue-cli-service build --mode development`

When I dig into the logs

13 verbose stack Error: my-website@0.1.0 build: `vue-cli-service build --mode development`
13 verbose stack Exit status 1

After I delete the public folder, it suddenly works

CodePudding user response:

There should be more log output which would be helpfull.

Based on your error maybe this helps: https://github.com/vuejs/vue-cli/issues/3420

also try deleting your package-lock file and run npm i again after that it hopefully works

CodePudding user response:

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

vue.config.js

module.exports = {
  outputDir : 'build',
}
  • Related