babel-node

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

孤人 提交于 2021-02-11 13:18:23
问题 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, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: js,json [nodemon] starting `babel-node index.js` 'babel-node' is not recognized as an internal or external command, operable program or batch file. [nodemon] app crashed -

babel-node is not getting installed on Heroku

こ雲淡風輕ζ 提交于 2020-01-06 05:35:32
问题 I'm using babel-node for ES6 syntax on Heroku, but I get a build error when I deploy. It says "babel-node: not found". I've tried a clean install on my local computer and it works perfectly. Package.json: { "name": "secret", "version": "0.0.0", "private": true, "scripts": { "start": "./node_modules/.bin/babel-node ./bin/www" }, "engines": { "node": "7.5.0", "npm": "5.0.3" }, "dependencies": { "babel-cli": "^6.24.1", "babel-preset-es2015": "^6.24.1", "babel-preset-stage-0": "^6.24.1", ... } }

Nodemon + babel restart the server multiple times

风流意气都作罢 提交于 2019-12-21 04:25:18
问题 In my package.json I have a start-script which I'm using for my dev enviroment. It looks like this: "scripts": { "dev": "NODE_PATH=src nodemon --watch src/ --exec babel-node src/app.js" } When I'm hitting npm run dev everything works fine and babel is transpiling everything as it should and nodemon starts watching. I see this: [nodemon] 1.11.0 [nodemon] to restart at any time, enter `rs` [nodemon] watching: /Users/Jonathan/Documents/swissnet/src/**/* [nodemon] starting `babel-node src/app.js`

How to configure babel correctly to use lodash-es?

左心房为你撑大大i 提交于 2019-12-11 02:21:44
问题 I need to use lodash-es in my project, but I can't configure my babel correctly, it always reports errors like SyntaxError: Unexpected identifier hello.js import upperCase from 'lodash-es/upperCase' console.log(upperCase('lodash-es')); package.json { "scripts": { "demo": "babel-node hello" }, "devDependencies": { "@babel/cli": "^7.0.0", "@babel/core": "^7.0.0", "@babel/node": "^7.0.0", "@babel/preset-env": "^7.0.0" }, "dependencies": { "lodash-es": "4.17.11" } } .babelrc { "presets": [ "

Why does this code not result in a ReferenceError?

萝らか妹 提交于 2019-12-02 06:12:55
问题 if(true) { tmp = 'abc'; console.log(tmp);//which should throw referenceError but not let tmp; console.log(tmp); tmp = 123; console.log(tmp); } This code results in abc undefined 123 Why does the first console.log(tmp) not throw an error? why it should throw a referenceError In ECMAScript 2015, let will hoist the variable to the top of the block. However, referencing the variable in the block before the variable declaration results in a ReferenceError. The variable is in a "temporal dead zone"

How to use babel-preset-env with Jest

若如初见. 提交于 2019-11-28 01:47:05
问题 We are in the midst of updating our API, and Henry Zhu from Babel alerted me to this preset called babel-preset-env to replace need for babel-preset-es2015 and babel-preset-es2018 . Now, I am encountering difficulty understanding the simplest way to handle everything. Our API uses node v8.x and async/await, native promises I want spread operator I want pipeline operator I want import/export syntax I want to support Jest I like how babel-node transpiles the API into memory This will be easier