-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid Version: undefined #5943
Comments
FYI reverting to 1.12.3 seems to work |
Pinning @babel/preset-env to 7.13.8 is what worked for me. The version check that is failing here was added in 7.13.9 here - babel/babel@c155caf#diff-cddb13dc00454073d19373b40529b8047e25b9141ab627eb8be482601f16eabe |
Yes, reverting to 1.12.3 is working |
Even a minimal repo with Parcel npm init -y && npm i parcel && touch index.js && echo "<html><body>Minimal Parcel<script src=\"./index.js\"></script></body></html>" > index.html Add a "scripts": {
"dev": "parcel index.html"
}, And then run Server running at http://localhost:1234
🚨 /Users/ben.lam/poc/testbuild/index.js: Invalid Version: undefined
at new SemVer (/Users/ben.lam/poc/testbuild/node_modules/@babel/preset-env/node_modules/semver/semver.js:314:11)
at compare (/Users/ben.lam/poc/testbuild/node_modules/@babel/preset-env/node_modules/semver/semver.js:647:10)
at lt (/Users/ben.lam/poc/testbuild/node_modules/@babel/preset-env/node_modules/semver/semver.js:688:10)
at /Users/ben.lam/poc/testbuild/node_modules/@babel/preset-env/lib/index.js:276:22
at Object.default (/Users/ben.lam/poc/testbuild/node_modules/@babel/helper-plugin-utils/lib/index.js:22:12)
at getEnvPlugins (/Users/ben.lam/poc/testbuild/node_modules/parcel/src/transforms/babel/env.js:62:34)
at getEnvConfig (/Users/ben.lam/poc/testbuild/node_modules/parcel/src/transforms/babel/env.js:12:25)
at async getBabelConfig (/Users/ben.lam/poc/testbuild/node_modules/parcel/src/transforms/babel/config.js:32:19)
at async babelTransform (/Users/ben.lam/poc/testbuild/node_modules/parcel/src/transforms/babel/transform.js:6:16)
at async JSAsset.pretransform (/Users/ben.lam/poc/testbuild/node_modules/parcel/src/assets/JSAsset.js:83:5) Like the others, pinning Parcel to "dependencies": {
"parcel": "1.12.3"
}, |
This seems to be caused by an update to It requires an object with a |
It seems this bug is present on both v1 and v2 babel/babel#12945 (comment) Although v1 is not maintained anymore, is it posssible to make an exception here and bump a patch in both version when the fix is available? |
Yes, I also had this problem |
You can workaround this by adding "resolutions": {
"@babel/preset-env": "7.13.8"
} to your |
Please fix this bug ASAP |
The workaround posted by @nicolo-ribaudo worked for me; thanks, Nicolò! |
I don't believe this occurs in Parcel 2 FWIW. The codepath linked in the babel issue is never hit: parcel/packages/transformers/babel/src/config.js Lines 39 to 41 in 806cc65
|
I would encourage folks to try out v2 as it's much more stable and actively maintained whereas v1 has been unmaintained for some time. Personally, I don't use v1 in any of my projects anymore, and v2 is being used in production by some big companies like Adobe and Atlassian. While we are very close to a v2 release candidate, the best way for now is to pin to a recent nightly. If that doesn't work for you, you can try the workaround posted by @nicolo-ribaudo above. |
Prompted by this issue I just made a switch to v2 few hours ago and so far I'm very happy with it. I had a bit of trouble with compiling Elm, but eventually got it to work. See here for details: #5948 |
I have this problem in v2 too. |
I just install parcel global yesterday and applied these ways above, |
same problem |
yarn global add [email protected] |
Server running at http://localhost:9999 🚨 /home/user/tmp/mist/src/index.js: Invalid Version: undefined we removed the semver statement inside the if clause |
@devongovett @mischnic Might I suggest pinning this until it's resolved; I imagine you're going to see a lot more duplicates.
Works great aside from the fact none of the plugins work for it. I do appreciate the much more stable file watching. But it's a non-starter since nothing aside from the core bundler works. It doesn't even detect old packages with an error or anything, it just silently ignores them. EDIT: Downgrading to 1.12.3 doesn't work for me. Nuking node_modules didn't change anything. I also have package-lock.json disabled and have exact versions enabled. <rant>
This isn't targeted at the Parcel devs in particular, though I'm getting really tired of having to have the "semver ranges are evil" talk and getting told I don't know what I'm talking about. 10 years later and these utopian views of perfect versioning semantics haven't panned out.
</rant>
To summarize #5943 (comment) for NPM users:
{
"name": "my-package",
"scripts": {
"preinstall": "npx npm-force-resolutions"
},
"resolutions": {
"@babel/preset-env": "7.13.8"
}
}
Note that this workaround only works at the top level; you cannot employ this as a library as it won't work for downstream consumers of your library. There's no workaround in such cases. |
@Qix- Which plugins in particular are you interested in? |
This commit adds the typescript declaration file. It further upgrades parcel to version 2. This needed to be done to get rid of the `Invalid Version: undefined` error (see parcel-bundler/parcel#5943).
This commit adds the typescript declaration file. It further upgrades parcel to version 2. This needed to be done to get rid of the `Invalid Version: undefined` error (see parcel-bundler/parcel#5943).
This commit adds the typescript declaration file. It further upgrades parcel to version 2. This needed to be done to get rid of the `Invalid Version: undefined` error (see parcel-bundler/parcel#5943).
This commit adds the typescript declaration file. It further upgrades parcel to version 2. This needed to be done to get rid of the `Invalid Version: undefined` error (see parcel-bundler/parcel#5943).
This commit adds the typescript declaration file. It further upgrades parcel to version 2. This needed to be done to get rid of the `Invalid Version: undefined` error (see parcel-bundler/parcel#5943). While doing so I also had to change the react import in the `example/index.js` due to a parcel bug (see parcel-bundler/parcel#1199).
The @babel/preset-env package starting at v7.13.9 and above will throw a "Invalid Version: undefined" error on build time, as a result of a conflict with parcel-bundler v1. See discussion here: parcel-bundler/parcel#5943 There is no fix in Parcel v1, so @babel/preset-env should be pegged here until Parcel is upgraded to v2 or another solution is found.
The @babel/preset-env package starting at v7.13.9 and above will throw a "Invalid Version: undefined" error on build time, as a result of a conflict with parcel-bundler v1. See discussion here: parcel-bundler/parcel#5943 There is no fix in Parcel v1, so @babel/preset-env should be pegged here until Parcel is upgraded to v2 or another solution is found.
Came across this problem myself today while trying to run a two year old tutorial regarding React.js and Wordpress. After much poking and prodding I discovered that it helps to clear your npm cache files. It seems that once you download the wrong version of @babel (at least in the context of the problem defined in this thread) then that is the version which keeps getting loaded into your node-modules directory. |
Getting the same error. can anyone please help me on fixing it? already have followed all the solution mentioned here, still no luck. any help on this would be great. Git repo - |
Yes! Try to downgrade to this version. I used v.1.12.4. I have spent half a day finding a solution - and only this switching worked for me! |
Everything is OK yesterday,but I've had this problem since I installed it again this morning
The text was updated successfully, but these errors were encountered: