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"
Asked
Active
Viewed 437 times
0
-
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 Answers
1
You should run npm run build
rather than vue build
.
They are two different commands.
npm run build
runs vue-cli-service build underlyingly, and its default entry is src/main.js.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
-
-
-
You need to be in the same repertory where your files are, then do `npm run build` – Julien J Feb 22 '20 at 11:50
-
-
-
0
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