BABEL FAILING WHILE USING NPM BUILD
See original GitHub issueBug Report
Current Behaviour
When i run npm run build
where the build command is
babel -d ./build . -s
I get a SyntaxError:
node_modules/@babel/helper-plugin-utils/src/index.js: Unexpected token, expected , (93:5)
91 | version,
92 | range,
93 | }: any),
| ^
94 | );
95 | }
my babel dependancies
"@babel/preset-es2015": "^7.0.0-beta.53",
"@babel/preset-es2017": "^7.0.0-beta.53",
"babel-core": "^6.26.3",
"babel-istanbul": "^0.12.2",
"babel-loader": "^8.0.4",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-register": "^6.26.0", `
my .babelrc file
{
"presets": [
"es2015",
"stage-3"
],
"plugins": [],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
}
my package.json file
"build-babel": "babel -d ./build . -s",
"clean": "rm -rf build && mkdir build",
"build": "npm run clean && npm run build-babel ",
Environment
-
Node/npm version: [ Node v8.11.3/npm 6.4.0]
-
OS: OSX 10.13.4
Possible Solution
Additional context/Screenshots Add any other context about the problem here. If applicable, add screenshots to help explain. when i navigate to the index file , I get this
if I place replace the colon with a comma, the build passes this stage but then fails with
Couldn't find preset "env" relative to directory "/Users/collinsmacharia/Documents/javascript/angular-4/moviefy/node_modules/babel-plugin-transform-regenerator/node_modules/regenerator-transform"
at /Users/collinsmacharia/Documents/javascript/angular-4/moviefy/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
at Array.map (<anonymous>)
at OptionManager.resolvePresets (/Users/collinsmacharia/Documents/javascript/angular-4/moviefy/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/Users/collinsmacharia/Documents/javascript/angular-4/moviefy/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/Users/collinsmacharia/Documents/javascript/angular-4/moviefy/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/Users/collinsmacharia/Documents/javascript/angular-4/moviefy/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (/Users/collinsmacharia/Documents/javascript/angular-4/moviefy/node_modules/babel-core/lib/transformation/file/index.js:212:65)
at new File (/Users/collinsmacharia/Documents/javascript/angular-4/moviefy/node_modules/babel-core/lib/transformation/file/index.js:135:24)
at Pipeline.transform (/Users/collinsmacharia/Documents/javascript/angular-4/moviefy/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transform (/Users/collinsmacharia/Documents/javascript/angular-4/moviefy/node_modules/babel-cli/lib/babel/util.js:50:22)
I would appreciate any sort of help
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
`npm run build` -> Error: Failed to parse package.json data ...
The error is related to babelify: The problem is that new version of babelify is changed and that requires to change package.json to...
Read more >Module build failed when using babel - node.js - Stack Overflow
I'm working on Laravel and VueJS application. Just want to use babel. Setup necessary babel packages: npm install @babel/core --save-dev npm ...
Read more >babel-loader - npm
Start using babel-loader in your project by running `npm i babel-loader`. ... Future webpack builds will attempt to read from the cache to ......
Read more >Search - appsloveworld.com
[Solved]-React build issue, ERROR in ./src/index.js Module build failed (from ./node_modules/babel-loader/lib/index.js):-Reactjs ... Another way to solve this is ...
Read more >Module build failed babel [#3134085] | Drupal.org
Fixed by deleting the lock file, yarn file and runnung npm install again. Well well another package manager, "no idea what went" wrong...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Moving my files into a
./src
directory and then changing my build to pull from that folder fixed this problem for me.I had this problem because of older babel version which I fixed using a stackoverflow answer : Check this stackoverflow answer : https://stackoverflow.com/a/53927430/6665568