parcel: length of undefined

🐛 bug report

🎛 Configuration (.babelrc, package.json, cli command)

{
  "name": "barcode_ball_panel",
  "version": "1.0.0",
  "description": "",
  "main": "out.js",
  "scripts": {
    "build": "parcel build --no-source-maps --public-url ./ index.html",
    "start": "parcel index.html",
    "clean": "rimraf dist",
    "nuke": "rimraf dist .cache"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/NikosEfthias/barcode_ball_panel.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/NikosEfthias/barcode_ball_panel/issues"
  },
  "homepage": "https://github.com/NikosEfthias/barcode_ball_panel#readme",
  "devDependencies": {
    "bs-platform": "^7.3.2",
    "bsb-js": "^1.1.7",
    "elm-hot": "^1.1.4",
    "eslint": "^6.8.0",
    "node-elm-compiler": "^5.0.4",
    "parcel-bundler": "^1.12.4",
    "rimraf": "^3.0.2"
  },
  "dependencies": {
    "bootstrap": "^4.5.0"
  }
}

🤔 Expected Behavior

parcelbundler used to build this project not i get an error it should just build fine as before since there are no updates to codebase

😯 Current Behavior

getting the following error

🚨  Cannot read property 'length' of undefined
    at lineCounter (/home/nikos/.projects/barcode_ball_panel/node_modules/parc
el-bundler/src/utils/lineCounter.js:3:30)
    at JSPackager.writeModule (/home/nikos/.projects/barcode_ball_panel/node_m
odules/parcel-bundler/src/packagers/JSPackager.js:127:60)
    at async JSPackager.addAsset (/home/nikos/.projects/barcode_ball_panel/nod
e_modules/parcel-bundler/src/packagers/JSPackager.js:88:5)
    at async Bundle._addDeps (/home/nikos/.projects/barcode_ball_panel/node_mo
dules/parcel-bundler/src/Bundle.js:250:5)
    at async Bundle._package (/home/nikos/.projects/barcode_ball_panel/node_mo
dules/parcel-bundler/src/Bundle.js:219:7)
    at async Promise.all (index 0)
    at async Bundle.package (/home/nikos/.projects/barcode_ball_panel/node_mod
ules/parcel-bundler/src/Bundle.js:202:5)
    at async Promise.all (index 1)
    at async Bundle.package (/home/nikos/.projects/barcode_ball_panel/node_mod
ules/parcel-bundler/src/Bundle.js:202:5)
    at async Promise.all (index 1)

💁 Possible Solution

No Clue

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 1.12.4
Node 14.1 and 12.18 both fails
npm/Yarn 6.14
Operating System ubuntu focal

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@danieltroger A source file with

let f = (v) => v?.variant;
console.log(f);

is enough to trigger this.

I could build with parcel by doing the following steps :

  • remove my global parcel installation, (yarn global remove parcel-bundler)
  • install parcel locally (yarn add --dev parcel@next)
  • add "start": "parcel src/index.html" in scripts of package.json
  • use yarn start to run parcel (since the global parcel command is not available anymore)

Does deleting the cache (.cache) help?

Thanks. I guess I will try to migrate to parcel 2 slowly then so its correct to assume this bug on parcel 1 will not be fixed and parcel 1 is no longer maintained right ?

@mischnic I dont now why would you close this while it is clearly a bug. Again I am having the same issue and cleaning cache does not help this time