Questions tagged [babel-node]

80 questions
3
votes
3 answers

[NODEMON]- babel-node not recognized as internal or external command

I am trying to setup a simple express server. I am using nodemon to start my development server But my app keeps crashing because it does not recognize the "babel-node" command. The error output is [nodemon] 2.0.7 [nodemon] to restart at any time,…
Dagmawi Asfaw
  • 39
  • 1
  • 7
3
votes
2 answers

babel-node is not recognized as internal or external command - Babel 7

I'm using babel v7.6.x and have set up the following. package.json "scripts": { "dev": "nodemon --exec babel-node bin/index.js", "start": "babel-node bin/index.js", "test": "echo \"Error: no test specified\" && exit 1" …
Syabster
  • 99
  • 2
  • 9
3
votes
0 answers

Babel extensions

How do I specify different extensions for babel to revolve, like webpack's resolve.extensions? I want to use .web.js in my browser build and (something like) .server.js for my node server files, so that this: import foo from './foo'; Will import…
3
votes
0 answers

Babel-node: Unexpected token import

I am running a react single page application and use auth0-js for authentication. After updating the auth0 version to 9.7.2 I get this error: (function (exports, require, module, __filename, __dirname) { import Authentication from…
alanj1998
  • 41
  • 5
3
votes
0 answers

babel-node not transpiling lerna imported code

I´m using lerna with some packages: packages - server - authenticator - graphql server is my current project and authenticator and graphql are imported modules. Here is my server package.json: { "name": "@monorepo/server", "version":…
Mendes
  • 17,489
  • 35
  • 150
  • 263
3
votes
1 answer

Can't launch VSCode debugger for node with babel-node

When I type npm run debug into the console I get: "Debugger listening on ws://127.0.0.1:3090/d17dfe56-4fa4-4686-a62e-d07cff78c834". When I go to this adress in chrome the only thing I see is "WebSockets request was expected". What parts of my config…
Umbrella
  • 1,085
  • 1
  • 14
  • 30
2
votes
1 answer

NodeJS JavaScript project with JS decorators (stage 3) and Babel doesn't work

I am trying to use JavaScript decorators (stage 3 proposal) in my NodeJS project, which is written in JavaScript. However, I am having trouble getting this to work with nodemon and babel together, so that the code will be recompiled when it is…
Anatoly
  • 5,056
  • 9
  • 62
  • 136
2
votes
2 answers

How to run Node.js app on Now.sh/Vercel after build into dist folder

I have the following scripts in my package.json "scripts": { "dev": "nodemon --exec babel-node src/index.js", "build": "NODE_ENV=PRODUCTION babel src -d dist --copy-files", "serve": "NODE_ENV=production node dist/index.js" }, My…
Ben S
  • 558
  • 3
  • 18
2
votes
2 answers

nodemon with bable-node crashes in the terminal but the server is running fine?

Im trying to use nodemon with bable-node. I have this command in my package.json: "open-graph-playground": "nodemon --exec babel-node src/graphql/mock-server.js", This is the JavaScript file: import fs from 'fs'; import open from 'open'; import {…
Evanss
  • 23,390
  • 94
  • 282
  • 505
2
votes
1 answer

vscode with Node 8 - inspect-brk error

I've recently upgraded my vscode and now I get this error when I try to run the service: D:\herokuworkspace\server/node_modules/.bin/babel-node.CMD --inspect-brk=27776 src\index.js D:\Program Files\nodejs\node.exe: bad option:…
David Faizulaev
  • 4,651
  • 21
  • 74
  • 124
2
votes
1 answer

How do you get correct variable names in babel-node debugger?

npm i babel-cli babel-preset-env echo '{"presets": ["env"]}' > .babelrc printf "import u from 'util';\ndebugger;\nconsole.log(u);\n" > foo.es babel-node --inspect-brk foo.es Continue to breakpoint F8 and inspect u. You get a ReferenceError: u is…
daxim
  • 39,270
  • 4
  • 65
  • 132
2
votes
0 answers

Acessing server files from client directory and the other way using create-react-app and babel-node

I have an ejected create-react-app client application and a server side application in the same bundle in a Windows 10 environment. My directory structure is as follows: app |--------- server.js |--------- package.json |--------- start-client.js …
Mendes
  • 17,489
  • 35
  • 150
  • 263
2
votes
1 answer

Import React in Node.js throws SyntaxError: Unexpected token export

I'm trying to implement SSR with Node.js and React following this example https://github.com/babel/example-node-server as advised in the official Babel docs here http://babeljs.io/docs/usage/cli/#babel-node For development, I'm using babel-node; for…
Anton Egorov
  • 1,328
  • 1
  • 16
  • 33
2
votes
1 answer

How to mock a method thats imported inside of another import

I'm testing in a ES6 babel-node environment. I want to mock a method thats used inside of the method I'm importing. The challenging part seems to be that the method I want to mock is imported into the file where the method I want to test resides.…
mpls423
  • 63
  • 1
  • 2
  • 8
2
votes
1 answer

Async Generator works on babel-node but fails w/ babel-register or build

Using babel-node I was able to run the following code function timeout(ms = 100) { return new Promise(resolve => { let id = setTimeout(() => { clearTimeout(id) resolve(ms) }, ms) }) } async function*…
vvMINOvv
  • 1,768
  • 4
  • 22
  • 45