Babel crypto

Comment

Author: Admin | 2025-04-28

I have a simple tests.js file that I wish to follow up with a source map file. I have tried initiating the dependencies yet the prompt shows the error. If anyone could specify the problem and the solution would be grateful ^^tests.jsvar add = (...arr) => { return arr.reduce((sum, el) =>{ return sum+el; }, 0)}console.log(add(1,2,3));I've tried these commands at firstnpm install -g babel-clinpm install babel-preset-es2015babel tests.js --out-file tests.dist.js --source-maps --presets=es2015But received the same error. I have followed another solution from the community but it still didn't work. The solution was to remove node_modules and reinitiate the dependencies. npm install --save-dev @babel/core @babel/cli @babel/preset-env @babel/nodeand add "start": "nodemon --exec babel-node index.js", in the dependencies.I checked the node_modules and it had the existence of these files too.node_modules/.bin/babel-nodenode_modules/.bin/babel-node.cmd - windows onlynode_modules/@babel/node/bin/babel-node.jsThe solution I followed Still, I couldn't figure out how to solve this issue. This is my first time working with node and babel. My node version is v16.13.1EditedFolder StructureY:.| index.html| package-lock.json| package.json| tests.js| tree.txt| \---node_modules | .package-lock.json | +---.bin | babel.....It's huge!package.json{ "dependencies": { "@babel/cli": "^7.16.8", "@babel/core": "^7.16.12", "@babel/preset-env": "^7.16.11" }}.babelrc{ "presents": [ "@babel/preset-env" ]}./node_modules/@babel/cli/bin/babel.jsrequire("../lib/babel");After using bash for the command -./node_modules/@babel/cli/bin/babel.js example.js --out-file main.dist.jsThe errorError: Unknown option: .presents. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options. at throwUnknownError (Y:\babel work\node_modules\@babel\core\lib\config\validation\options.js:133:27) at Y:\babel work\node_modules\@babel\core\lib\config\validation\options.js:118:5 at Array.forEach () at validateNested (Y:\babel work\node_modules\@babel\core\lib\config\validation\options.js:94:21) at validate (Y:\babel work\node_modules\@babel\core\lib\config\validation\options.js:85:10) at Y:\babel work\node_modules\@babel\core\lib\config\config-chain.js:209:34 at cachedFunction (Y:\babel work\node_modules\@babel\core\lib\config\caching.js:60:27) at cachedFunction.next () at evaluateSync (Y:\babel work\node_modules\gensync\index.js:251:28) at sync (Y:\babel work\node_modules\gensync\index.js:89:14) { code: 'BABEL_UNKNOWN_OPTION'}

Add Comment