How can I solve the Build failed error in npm parcel

  Kiến thức lập trình

I am learning JavaScript from a Udemy course.
I run into a problem with running the parcel.
I installed parcel 2 as the video instructed, but when I try to run it, it says my files must be .js. In the video, he changes the main to index.html, but he runs without issues.

Can anyone tell me how I can solve this issue?

I have installed the parcel, but when I try to start it as the video says, I get an error.
It says the main file format should not be HTML. However, the video changes the main part in the JSON.package to index.html.

How do I fix it ??

Server running at http://localhost:1234
???? Build failed.

@parcel/core: Unexpected output file type .html in target
“main”

/Users/nasersobhan/Desktop/Coding/The complete JavaScript Course Udemy/complete-javascript-course-master/18-forkify/starter/package.json:5:11
4 | “description”: “Recipe application”,

5 | “main”: “index.html”,
| ^^^^^^^^^^^^ File extension must be .js, .mjs, or .cjs
6 | “scripts”: {
7 | “start”: “parcel index.html”,

???? The “main” field is meant for libraries. If you meant
to output a .html file, either remove the “main” field
or choose a different target name.
???? Learn more:
https://parceljs.org/features/targets/#library-targets

LEAVE A COMMENT