Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

243
Vistas
Parcel SemVer bug

So, I've used Parcel multiple times before and I've never had an issue with it. This time it throws some stupid errors about SemVer versioning and I'm literally loosing my mind trying to find a solution which would fix this problem.

I've started new project: installed npm w/ npm init (no additional options), then installed parcel npm install --save-dev parcel-bundler and then created my folder structure:

--node_modules
--index.html
--index.js

Here is my package.json:

{
  "name": "playground",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "parcel index.html"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "parcel-bundler": "^1.12.4"
  }
}

I've configured default npm script to run parcel: "dev": "parcel index.html" and run it. Everything works fine, however when I connect my index.js in index.html via <script src="/index.js"></script> it throws big fat error, saying:

D:\workingSpace\playground\index.js: Invalid Version: undefined
  at new SemVer (D:\workingSpace\playground\node_modules\@babel\preset-env\node_modules\semver\semver.js:314:11)
  at compare (D:\workingSpace\playground\node_modules\@babel\preset-env\node_modules\semver\semver.js:647:10)   
  at lt (D:\workingSpace\playground\node_modules\@babel\preset-env\node_modules\semver\semver.js:688:10)        
  at D:\workingSpace\playground\node_modules\@babel\preset-env\lib\index.js:276:22
  at Object.default (D:\workingSpace\playground\node_modules\@babel\helper-plugin-utils\lib\index.js:22:12)     
  at getEnvPlugins (D:\workingSpace\playground\node_modules\parcel-bundler\src\transforms\babel\env.js:62:34)   
  at getEnvConfig (D:\workingSpace\playground\node_modules\parcel-bundler\src\transforms\babel\env.js:12:25)    
  at async getBabelConfig (D:\workingSpace\playground\node_modules\parcel-bundler\src\transforms\babel\config.js:32:19)
  at async babelTransform (D:\workingSpace\playground\node_modules\parcel-bundler\src\transforms\babel\transform.js:6:16)
  at async JSAsset.pretransform (D:\workingSpace\playground\node_modules\parcel-bundler\src\assets\JSAsset.js:83:5)

Currently I'm using Node v14.6.0 and accordingly it's npm version - 6.14.11

I've never faced this bug before, please help T_T

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

This is a known problem in the newest version of Parcel.

The solution of this problem was to revert back to version 1.12.3, or by updating to the version 2 of Parcel. You can do the first solution by:

npm uninstall parcel-bundler
npm i --save-dev parcel-bundler@1.12.3

The second solution could be done like this:

npm i --save-dev parcel@next

You might have to refactor your code a bit to prevent breaking changes if you decided to use the nightly version of Parcel. Check more about how to migrate to Parcel v2 / nightly here.

Catch up with that issue here.


Update #1: 28/05/2021

It seems that Parcel team has been working on a fix, as of the time of writing (28/05/2021). While I have not personally checked if the update has worked properly or not, this answer is still very much a viable and feasible solution.

over 4 years ago · Santiago Trujillo Denunciar

0

I have recently went through this issue, where parcel@1.12.4 kept throwing Invalid Version: undefined even after trying a very logical workound posted on GitHub #5943.

Installing parcelV2 worked in my case. If anyone else is facing a similar problem, I would recommend trying the following steps:

  1. npm uninstall -D parcel-bundler
  2. npm install -D parcel@next
  3. npx parcel serve index.html
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda