0

I am trying to save a .vue file. I have installed vue cli. When I run the vue serve an error message displays in the command prompt which says "valid entry file should be one of:main.js, index.js, app.vue, App.vue"

Madhu
  • 7
  • 4
  • As the error message clearly states, it is not able to locate the entry file. So, can you tell us where exactly the entry file located? – Deepak Terse May 05 '20 at 16:22

2 Answers2

1

You should run npm run build rather than vue build.

They are two different commands.

  1. npm run build runs vue-cli-service build underlyingly, and its default entry is src/main.js.

  2. vue build is for instant prototyping only. Its default entry is one of main.js, index.js, App.vue or app.vue in the current directory.

Julien J
  • 2,826
  • 2
  • 25
  • 28
0

Folder structure

As you can see in the image above, main.js file is located in the src folder. I specified the path to the main.js file in the package.json file as follows:

"scripts": {
    "dev": "vue serve src/main.js",
    "prod": "vue build src/main.js"
}

And then I could simply run

npm run dev

for serving the project in the development environment and

npm run prod

for creating a production build under dist folder

Deepak Terse
  • 652
  • 8
  • 30