babel/core and babel/polyfill is not working for nodejs - babeljs

"devDependencies": {
"#babel/cli": "^7.17.6",
"#babel/core": "^7.17.8",
"#babel/polyfill": "^7.12.1",
"#babel/preset-env": "^7.16.11"
}
}
This is my development dependencies and i keep getting the issue on the terminal;
npm WARN deprecated #babel/polyfill#7.12.1: 🚨 This package has been deprecated in favor of separate inclusion of a polyfill and regenerator-runtime (when needed). See the #babel/polyfill docs (https://babeljs.io/docs/en/babel-polyfill) for more information.
npm WARN deprecated core-js#2.6.12: core-js#\<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
Anybody know why this is happening?
I was just going to use babel in my project and some of them didn't work somehow.

Related

#nuxt/babel-preset-app > core-js#2.6.12: core-js#<3.4 is no longer maintained and not recommended

I have an application which has core.js dependecy defined as "core-js": "^3.19.1" in package.json. But as I try to run yarn install it thorws me a warning
#nuxt/babel-preset-app > core-js#2.6.12: core-js#<3.4 is no longer maintained and not recommended
I dont understand how is it possible cause there is explicitely defined version 3.19
Can somebody explain me please what happened there and how to fix it?
Thanks a lot.

warning Lockfile has incorrect entry for "prismjs#1.24.0". Ignoring it

I have inherited an issue with prismjs whereby I have to remove/reinstall it every time I add/upgrade another package.
I have a gocd pipeline validation that fails every time I try to use dependabot to address security vulnerabilities on my repo.
Goes something like this....
dependabot generates pull request
validation fails with error "warning Lockfile has incorrect entry for "prismjs#1.24.0". Ignoring it"
Pull down master branch > upgrade package manually > remove/install prismjs#1.24.0
Generate new PR > validation succeeds and everything works fine.
Merge with master
rinse and repeat.
What I am seeing is that I have 2 entries in my yarn.lock for prismjs and removing it only removes the 1.24.0 entry AND, if I leave 1.24.0 removed the validation still fails because it cant find prismjs 1.24.0.
prismjs#1.24.0:
version "1.24.0"
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.24.0.tgz#0409c30068a6c52c89ef7f1089b3ca4de56be2ac"
integrity sha512-SqV5GRsNqnzCL8k5dfAjCNhUrF3pR0A9lTDSCUZeh/LIshheXJEaP0hwLz2t4XHivd2J/v2HR+gRnigzeKe3cQ==
prismjs#^1.23.0, prismjs#^1.8.4, prismjs#~1.17.0:
version "1.26.0"
resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.26.0.tgz#16881b594828bb6b45296083a8cbab46b0accd47"
integrity sha512-HUoH9C5Z3jKkl3UunCyiD5jwk0+Hz0fIgQ2nbwU2Oo/ceuTAQAg+pPVnfdt2TJWRVLcxKh9iuoYDUSc8clb5UQ==
package.json:
"dependencies": {
"comma-separated-tokens": "^1.0.0",
"elliptic": "^6.0.0",
"handlebars": "^4.1.2",
"http-proxy": "^1.17.0",
"https-proxy-agent": "^2.2.1",
"immer": "9.0.6",
"ini": "^1.3.5",
"lodash": "^4.5.1",
"markdown-to-jsx": "^6.9.1",
"merge-deep": "^3.0.2",
"nested-object-assign": "1.0.4",
"parse-headers": "^2.0.0",
"prismjs": "1.24.0",
"space-separated-tokens": "^1.0.0",
"ssri": "^6.0.1",
"tar": "4.4.19",
"tree-kill": "^1.1.0",
"ua-parser-js": "^0.7.9",
"url-parse": "^1.4.3",
"websocket-extensions": ">=0.1.1",
"y18n": "^4.0.0",
"yargs-parser": "^13.1.1"
},
"resolutions": {
"prismjs": "^1.23.0",
"property-expr": "^2.0.3"
I'm relatively new to how this versioning works and like I say I inherited this issue so I don't really have a history besides what I can see in github.
Any help would be greatly appreciated.
By Running yarn why prismjs that will explain which packages other than your project depend on prismjs.
I'm not sure if you've other packages that depend on prismjs to explain these other entries. It seems that some of the dependencies are hoisted to me. If you've a monorepo setup or work with nested packages, that could explain it.
Maybe helpful info as well, according to Yarn docs
You will receive a warning if your resolution version or range is not compatible with the original version range.
Nested packages may not work properly.

I am having an issue with babel building angular app for production

Current Behavior
I am building my angular project on circleci and it just keeps failing with the following message:
An unhandled exception occurred: Cannot find module
'#babel/compat-data/corejs3-shipped-proposals'
Require stack:
/home/circleci/eleven-app/frontend/node_modules/#angular-devkit/build-angular/node_modules/#babel/preset-env/lib/polyfills/corejs3/usage-plugin.js
/home/circleci/eleven-app/frontend/node_modules/#angular-devkit/build-angular/node_modules/#babel/preset-env/lib/index.js
/home/circleci/eleven-app/frontend/node_modules/#angular-devkit/build-angular/node_modules/#babel/core/lib/config/files/plugins.js
/home/circleci/eleven-app/frontend/node_modules/#angular-devkit/build-angular/node_modules/#babel/core/lib/config/files/index.js
/home/circleci/eleven-app/frontend/node_modules/#angular-devkit/build-angular/node_modules/#babel/core/lib/index.js
/home/circleci/eleven-app/frontend/node_modules/#angular-devkit/build-angular/src/utils/process-bundle.js
/home/circleci/eleven-app/frontend/node_modules/jest-worker/build/workers/processChild.js
I am using
{
"#babel/plugin-proposal-numeric-separator": "^7.8.3",
"core-js": "3.2.1",
"tslib": "^1.11.1",
"#babel/compat-data": "~7.8.0",
"#babel/runtime-corejs3": "^7.9.2",
"ts-node": "7.0.0",
"tslint": "5.11.0",
"typescript": "3.5.3",
}
resolutions: {
"#babel/preset-env": "^7.8.7"
}
here is npx nls why #babel/preset-env output:
eleven-app-frontend > #angular-devkit/build-angular > #babel/preset-env#7.8.7
eleven-app-frontend > #nrwl/angular > #nrwl/cypress > #cypress/webpack-preprocessor > #babel/preset-env#7.9.5
eleven-app-frontend > #nrwl/cypress > #cypress/webpack-preprocessor > #babel/preset-env#7.9.5
Thank you for reading.
Had the same issue today, so I'm assuming there's something weird with the latest version.
My package.json had the following:
"#babel/compat-data": "~7.9.0"
I removed the ~ to force 7.9.0 instead of allowing newer ones and it did the trick for me.
There's probably a newer version that works but since you opened an issue for them (https://github.com/babel/babel/issues/11427) I'll just wait for more details.
I've the same issue when using TravisCI & Vue with Jest and Babel. My test suit has been failing. Adding "#babel/compat-data": "7.9.0" to devDependencies in my package.json file solved my problems.
These 3 options we came up with so far:
Adapt dependency of babel/preset-env to v7.9.0: "#babel/preset-env": "=7.9.0"
In case you use a NodeJS Docker Image, fix the version to something below 13.13, i.e.: node:13.12.0-alpine
Adding or upgrading "#babel/compat-data": "7.9.0" to devDependencies
The solutions are temporarily and should be removed as soon as there is an actual fix of the node images or the babel/preset-env library.
Linked Github issues:
babel - https://github.com/babel/babel/issues/11427
nodejs - https://github.com/nodejs/node/issues/32852#issuecomment-613652057
I had the same issue today in Github Actions build for a Vue FE project. It builds fine locally. I'm going to try the solution above and I'll report back...
Update: After looking through the package-lock file, my solution was to explicitly add "#babel/compat-data" to the prod dependencies. Previously it was only a dependency for some dev dependencies. So my package.json now looks like:
"dependencies": {
"#babel/compat-data": "^7.8.6",
...
Same issue.
Solved it by following above advices + removing node_modules (see this github thread):
Added explicitly #babel/compat-data": "7.9.0" to devDependencies
Upgraded node (13.3 to 14.0 in my case)
Had to remove my node_modules folder and re run yarn (or npm)
If you're using yarn, try to remove the yarn.lock file in your project. And then reinstall by run yarn install; you'll get a new yarn.lock file, which is fine.
It worked for me in my Next.js project.

Material-UI v1.0.0.-beta Issue with React-Transition-Group

While testing material-ui v1.0.0-beta, I encountered with the following error when building using webpack 3.8.0. I came across with few other questions like this, too, but am hoping if someone could confirm this is a legitimate issue and is still seen by people? I even added "react-transition-group": "^2.2.1" to package.json and so far no luck. Thanks in advance for your help.
ERROR in ../node_modules/material-ui-next/ButtonBase/Ripple.js
Module not found: Error: Can't resolve 'react-transition-group/Transition' in './node_modules/material-ui-next/ButtonBase'
I have "react-router": "^3.2.0", in my package.json in case this may help folks understand what might be the root cause.
[UPDATE] While investigating, I removed node_modules and issued npm cache clean as well as ensure the global cache is cleared by issuing npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm. This didn't fix the issue.
Follow the steps explained in this ticket for solution: material-ui-next/9356
Summary of Solution
The issue relates to how webpack searches for dependencies at build time and establishes the dependency graph of all peer dependencies for each and every module. When digging further, I noted that material-ui#0.19.4 has react-transition-group#1.2.1 as its peer dependency while material-ui-next#1.0.0 beta has react-transition-group#2.2.1 as its peer dependency. Furthermore, I suspect because I have both material-ui releases on my project, when importing a component from material-ui-next, the expected path for react-transition-group#2.2.1 from material-ui-next's perspective is project/node_modules but apparently due to having two versions of material-ui, the later installs react-transition-group#2.2.1 under material-ui-next.
In webpack path configurations, add the following:
module.exports = {
app: path.resolve(CURRENT_WORKING_DIR, "app"),
assets: path.resolve(CURRENT_WORKING_DIR, "public", "assets"),
compiled: path.resolve(CURRENT_WORKING_DIR, "compiled"),
public: "/assets/",
modules: path.resolve(CURRENT_WORKING_DIR, "node_modules"),
extraModules: path.resolve(CURRENT_WORKING_DIR,
"node_modules/material-ui-next/node_modules"),
};
And finally add the extra path to webpack's resolve attribute:
module.exports = {
modules: [PATHS.app, PATHS.modules, PATHS.extraModules],
extensions: [".js", ".jsx", ".css"],
};
to fix above issue:
please install react-transition-group
npm i react-transition-group#next --save

Mocha Express Coffee should.equal not working

I am following a tutorial. While I run
require "should"
describe "feature", ->
it "should add two numbers", ->
(2+2).should.equal 4
And i run
mocha routes-test.coffee --compilers coffee:coffee-script
I get following errors
1) feature should add two numbers:
AssertionError: expected {} to be true
at Object.true (/home/../../coffeepress/node_modules/should/lib/should.js:251:10)
at Context.<anonymous> (/home/../../coffeepress/test/routes-test.coffee:7:28)
at Test.Runnable.run (/usr/lib/node_modules/mocha/lib/runnable.js:184:32)
at Runner.runTest (/usr/lib/node_modules/mocha/lib/runner.js:300:10)
at Runner.runTests.next (/usr/lib/node_modules/mocha/lib/runner.js:346:12)
at next (/usr/lib/node_modules/mocha/lib/runner.js:228:14)
at Runner.hooks (/usr/lib/node_modules/mocha/lib/runner.js:237:7)
at next (/usr/lib/node_modules/mocha/lib/runner.js:185:23)
at Runner.hook (/usr/lib/node_modules/mocha/lib/runner.js:205:5)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
What is going on here? I installed should.js ( npm install should) and mocha. Is there some syntax mistake or some setting mistakes?
Your problem is likely a mismatch between your node version and the versions of mocha and should that you used. If you used the package.json file from that tutorial exactly you would have loaded mocha 0.10.0 and should 0.5.1. When I tried the same thing with a current version of node (v0.8.1) I saw the following warnings when doing npm install:
npm WARN engine mocha#0.10.0: wanted: {"node":">= 0.4.x < 0.7.0"} (current: {"node":"0.8.1","npm":"1.1.34"})
npm WARN engine commander#0.5.1: wanted: {"node":">= 0.4.x < 0.7.0"} (current: {"node":"0.8.1","npm":"1.1.34"})
And then when I run mocha against the example test you've provided I get the same error.
Simply changing the mocha and should versions in my package.json to be
"mocha": ">=0.10.0",
"should": ">=0.5.1"
then running npm update fixed the problem and the test ran fine. You can also set those versions to "latest" or the current versions of those packages if you'd like to lock them down ("1.3.0" and "0.6.3" respectively at the time I write this).