Latest

Tuesday, July 11, 2017

Laravel 5.4 'cross-env' is not recognized as an internal or external command

Asked by: Arthur Tarasov


I'm trying to run npm run dev for Laravel Mix and I get this error:

> @ dev D:\projects\ptcs
> cross-env NODE_ENV=development webpack --progress --hide-modules --
config=node_modules/laravel-mix/setup/webpack.config.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! @ dev: `cross-env NODE_ENV=development webpack --progress --hide-
modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.

I updated node.js to 6.11.0 and npm to 5.2.0, but it didn't help. I'm running Homestead on Windows 7.


Answers

Answered by: only4 at 2017-07-11 05:58PM



Before try running npm run dev please run npm install --no-bin-links in the project directory, this will install all required packages. Also check this link for compiling instruction. https://laravel.com/docs/5.4/mix

Also double check in your conf file, wherever you find something like this

(something)/cross-env/bin/(something)

change it to

(something)/cross-env/dist/bin/(something)

If you are using homestead, in package.json paste this

{ "private": true, "scripts": { "dev": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "watch-poll": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --watch-poll --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" }, "devDependencies": { "axios": "^0.15.3", "bootstrap-sass": "^3.3.7", "cross-env": "^3.2.3", "jquery": "^3.1.1", "laravel-mix": "^0.8.1", "lodash": "^4.17.4", "vue": "^2.1.10" } }

Also check this link https://github.com/JeffreyWay/laravel-mix/issues/478




Source

No comments:

Post a Comment

Adbox