BABEL_ENV is not recognized as an internal or external command, operable program or batch file

QuestionsCategory: Laravel'cross-env' is not recognized as an internal or external command laravel 7 Vue js

‘cross-env’ is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! development: cross-env NODE_ENV=development BABEL_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Fix - 'cross-env' is not recognized as an internal or external command #

To solve the error "cross-env is not recognized as an internal or external command, operable program or batch file", open your terminal in your project's root directory and install the cross-env package by running npm install --save-dev cross-env.

Open your terminal in your project's root directory (where your package.json file is located) and run the following command:

Copied!

# 👇️ installs cross-env locally npm install --save-dev cross-env # 👇️ installs cross-env globally (can run from any directory) npm install -g cross-env # ---------------------------------------------- # 👇️ installs cross-env locally yarn add cross-env --dev # 👇️ installs cross-env globally (can run from any directory) yarn add cross-env --global

The command will add the cross-env package to the development dependencies of your project.

The benefit of installing cross-env as a development dependency is that you can control the version of the package in your package.json file.

You can also define commands in the scripts object of your package.json file.

Copied!

{ "scripts": { "build": "cross-env NODE_ENV=production webpack --config build/webpack.config.js" } }

This works because npm will resolve cross-env from your node_modules directory because you ran npm install --save-dev cross-env.

Now you would run the command as npm run build, and not use cross-env directly.

If the error is not resolved, try to delete your node_modules and package-lock.json (not package.json) files, re-run npm install and restart your IDE.

Copied!

# 👇️ delete node_modules and package-lock.json rm -rf node_modules rm -f package-lock.json # 👇️ clean npm cache npm cache clean --force npm install

Make sure to restart your IDE and dev server if the error persists. VSCode often glitches and needs a reboot.

Alternatively, you solve the error by prefixing the command with npx.

Copied!

# 👇️ prefix with npx npx cross-env NODE_ENV=production webpack --config build/webpack.config.js

The npx prefix will look for the cross-env package in your local dependencies and if it's not found, it will install the package before running the command.

Question:

I’m working on node.js project. I have created this project by use Babel which was running fine in previous using node system . i have updated node.js version in my system, after that I’m getting error of Bebel-node. Any one can help me how can i solve this issue??b I have installed all bebal.js module.

I'm using code in bebel.rc { "plugins": [ "@babel/plugin-transform-runtime" ], "presets": [ "@babel/env" ], "ignore": [ "node_modules", "src/public" ] } this is my updated package.json .... { "name": "backend-buluckart-hashing.company", "version": "0.1.0", "description": "groffers-nepal", "main": "index.js", "scripts": { "start": "nodemon src/index.js --exec babel-node --presets @babel/env", "build": "babel src -d dist --source-maps inline --copy-files", "serve": "node dist/index.js", "sequelize": "sequelize" }, "keywords": [], "author": "Ashutosh singh", "license": "ISC", "homepage": "", "nodemonConfig": { "ignore": [ "src/public/*" ] }, "devDependencies": { "@babel/cli": "^7.17.6", "@babel/core": "^7.17.5", "@babel/node": "^7.16.8", "@babel/plugin-transform-runtime": "^7.17.0", "@babel/preset-env": "^7.16.11", "nodemon": "^2.0.15" }, "dependencies": { "@babel/runtime": "^7.17.2", "aws-sdk": "^2.700.0", "babel-upgrade": "^1.0.1", "bcrypt-nodejs": "0.0.3", "body-parser": "^1.18.3", "cookie-parser": "^1.4.3", "cors": "^2.8.5", "dateformat": "^3.0.3", "dotenv": "^8.0.0", "event-stream": "^4.0.1", "express": "^4.16.3", "express-handlebars": "^6.0.2", "express-sanitizer": "^1.0.5", "express-session": "^1.15.6", "helmet": "^3.15.1", "joi": "^14.3.0", "joi-date-extensions": "^1.2.0", "jsonwebtoken": "^8.3.0", "kue": "^0.11.1", "mailparser": "^3.4.0", "moment": "^2.24.0", "morgan": "^1.9.0", "multer": "^1.4.1", "multer-s3": "^2.9.0", "mysql": "^2.16.0", "mysql2": "^1.6.4", "passport": "^0.4.0", "passport-jwt": "^4.0.0", "passport-local": "^1.0.0", "qs": "^6.10.3", "radis": "^2.0.0", "razorpay": "^2.0.6", "react-bootstrap": "^2.1.2", "read-excel-file": "^5.2.26", "request": "^2.88.0", "rotating-file-stream": "^1.4.1", "sequelize": "^5.21.13", "sequelize-cli": "^6.4.1", "speakeasy": "^2.0.0", "stack-trace": "0.0.10", "twilio": "^3.72.0" } }

Answer:

"start": "nodemon --exec npx babel-node src/index.js",

If you have better answer, please add a comment about this, thank you!

If you like this answer, you can give me a coffee by click here (view Ads)