-1

I was learning JavaScript and kind of ran into problem that said like this : Error Image

Here's my package.json enter image description here

So to explain, this is my vanilla js where i have installed parcel

Vs code Terminal

  • npm i parcel --save-dev
  • npm run start
  • npm run build

theen this error pops up. I don't know if i added enough screenshots or details to make someone understand my problem. If you do have a solution help please.

Edit : I also tried,

"main" : "17th.html" as suggested which then threw new error saying the extension should be of .js

Final edit : So , i deleted "main" and then it worked like a charm. Dont know why it works but it works . If someone could explain why it works then i would be very grateful.

I was expeccting a successful build

2 Answers2

0

Entry should be an html file like

main: "17th.html"
0

I had the same issue, what worked for me was just deleting

main: "filepath"

You can also organize this better by having a src folder and moving all your html files there, a js folder which contains all your js files and a css folder that contains all your css files.

Below is my paackage.json which builds as intended.

{
  "name": "something",
  "version": "1.0.0",
  "description": "stackoverflow example",
  "scripts": {
    "dev": "parcel src/index.html",
    "build": "parcel build src/index.html"
  },
  "author": "my name",
  "license": "ISC",
  "devDependencies": {
    "@parcel/transformer-sass": "^2.6.2",
    "parcel": "^2.6.2"
  },
  "dependencies": {
    "gsap": "npm:@gsap/shockingly@^3.10.4"
  }
}
WizardOfOz
  • 131
  • 8
  • Hi , Thankyou. Umm deleted the " main " and it build successfuly. I don't know why it works , but it does. Also , is it safe ? Since we are deleting the 'main' ? – Tabsum Khadka Nov 23 '22 at 06:18
  • They don't have the main on the documentation here: https://parceljs.org/getting-started/webapp/ but they do have the source as it's own property. – WizardOfOz Nov 23 '22 at 06:21