Questions tagged [babel-node]

80 questions
1
vote
0 answers

Correct way to spawn a node script

What is the correct way to spawn the following script from package.json: "start": "nodemon --exec \"cd ./src && babel-node --only \".,../../../node_modules/@workspace/graphql/src\" server.js \"", This is my try so far: start.js: const spawn =…
Mendes
  • 17,489
  • 35
  • 150
  • 263
1
vote
1 answer

babel-node vs node: graphql files with import/exports

It appears that NodeJS does not understand import/export commands in graphql files (extension .gql), but babel-node does. The only fix I can come up with is to rename the .gql files to .js files, but I lose syntax highlighting. Is there a simple…
Jeff Lowery
  • 2,492
  • 2
  • 32
  • 40
1
vote
0 answers

Error - Using babel.node for start script when deploying on heroku - what to do in production?

When deploying on heroku, Im getting the following error: npm ERR! Tell the author that this fails on your system: npm ERR! babel-node server/app.js --presets es2015,stage-2 My package.json: "scripts": { "start": "babel-node server.js…
javascripting
  • 1,135
  • 4
  • 25
  • 46
1
vote
1 answer

I get "React not defined" when using express, create-react-app and babel-node

I just wanted to enable server-side rendering with react and create-react-app. I've written a server/index.js file which should return a simple react component as a string. //require('import-export'); //require('babel-register')({ ignore:…
1
vote
0 answers

How to run babel-node in deattach mode

I follow this tutorial. It uses NODE_ENV=production node_modules/.bin/babel-node --presets 'react,es2015' src/server.js My 1st question is: How to I run the command line above in deattach mode? i.e. the command line above doesn't allow me to quit…
kenpeter
  • 7,404
  • 14
  • 64
  • 95
1
vote
1 answer

Webpack module resolution issues on Windows 10

I'm having issues with Webpack resolving module names on Windows. The loaders are installed, but the path Webpack is using to try to resolve them is incorrect (notice the fact that it's concatenated the module path to the working directory below).…
terry87
  • 445
  • 1
  • 4
  • 15
0
votes
1 answer

Unable to run babel-node via shell command

I am trying to use babel-node to run files in my node project. I am able to get them running if I set up an npm script, such as: "scripts": { "start": "babel-node src/index.js" }, However, if I try to run it via the cli, I get the error: zsh:…
713sean
  • 313
  • 11
0
votes
0 answers

How do I run babel-node in a typescript project?

I have been stuck on this for a while and haven't found a working configuration. My goal is to have a project that will run in a node environment, using typescript. I would like to skip manually pre-compiling my code into javascript, hence I would…
713sean
  • 313
  • 11
0
votes
0 answers

Node Js - babel-node is not recognized as an internal or external command

How to solve this issue for Node JS babel-node is not recognized as an internal or external command.
Sajjad
  • 1
  • 4
0
votes
0 answers

What could be affecting my Node.JS environment that does not allow me to debug my JS with babel-node?

I have a Node JS server written with ES6 features and use Babel to transpile the code for production. The code itself complies and works fine. I am also able to run my "dev" server and test it locally with this command: npm run dev which runs this…
rctexas
  • 1
  • 2
0
votes
1 answer

React-native: [NODEMON] starting `babel-node src`, "babel-node" is not recognized as an internal or external command, while I run 'npm run dev'

I'm using nodemon to start an example with a hello world in a React Native app. But my app keeps crashing because it does not recognize the "babel-node" command when I execute "npm run dev". The error output is: [nodemon] to restart at any time,…
0
votes
2 answers

babel-node --presets node '.' is not recognized as an internal or external command,

this is the dependencies in package.json { "name": "whatsapp", "version": "1.0.0", "description": "whatsapp-clone-in-mern-stack", "main": "server.js", "scripts": { "start": "./node_modules/babel-cli/bin/babel-node.js --presets node8…
Krishnadev. V
  • 345
  • 2
  • 8
  • 23
0
votes
0 answers

Cannot find module 'babel-node'

I am trying to run some React code on my server-side using node. Following a tutorial, I am trying to add babel to my node server so that JSX gets transpiled to JS. I added the run scripts to my json.config to use babel-node as below (I use the…
M_Zarnowski
  • 126
  • 2
  • 8
0
votes
0 answers

Webpack definePlugin equivalent for babel-node

I'm creating an SSR React app, I'm using babel-node for server and webpack for client. I'm facing sharing/accessing env variables. For client (webpack), I use webpack.DefinePlugin and access .env with fetch(${API_V1}/get-product), Without…
Raman Choudhary
  • 4,283
  • 2
  • 14
  • 25
0
votes
1 answer

babel-node fails when babel cli works correctly

EDIT: The solution was to remove type=module from package.json I'm trying to use babel-node and it's failing to pickup presets from .babelrc. The odd thing is the babel cli is working just fine. This works: $ npx babel src/build-html.js This…
joelnet
  • 13,621
  • 5
  • 35
  • 49