I normally use npm run watch while editing sass file. This timenpm run watch was misbehaving like continuously working without stopping, but that time no errors. When I suddenly stopped it, and after few time run it again I am getting this error for no reason. I didn't do anything else after terminating the process just edited the sass file.
> # production D:\Advaith\Laravel\MyBlog
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --
progress --hide-modules --config=node_modules/laravel-
mix/setup/webpack.config.js
undefined:1
SyntaxError: Unexpected end of JSON input
at Object.parse (native)
at Manifest.read (D:\Advaith\Laravel\MyBlog\node_modules\laravel-mix\src\Manifest.js:138:21)
at new Manifest (D:\Advaith\Laravel\MyBlog\node_modules\laravel-mix\src\Manifest.js:9:43)
at Mix.initialize (D:\Advaith\Laravel\MyBlog\node_modules\laravel-mix\src\Mix.js:27:25)
at Object.<anonymous> (D:\Advaith\Laravel\MyBlog\node_modules\laravel-mix\setup\webpack.config.js:35:5)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "E:\\Node Js\\node.exe" "E:\\Node Js\\node_modules\\npm\\bin\\npm-cli.js" "run" "production"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! # production: `cross-env NODE_ENV=production
node_modules/webpack/bin/webpack.js --progress --hide-modules --
config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # production script 'cross-env NODE_ENV=production
node_modules/webpack/bin/webpack.js --progress --hide-modules --
config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=production
node_modules/webpack/bin/webpack.js --progress --hide-modules --
config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\Advaith\Laravel\MyBlog\npm-debug.log
As per the error I tried to update my node and npm. Before I was using node version v6.6.0, then I updated it to v6.10.2, but could not find in any change in the error other than the version.
I tried deleting the node_molecules and run npm install again.
tried npm cache clear.
How can I fix this error??
My package.json file looks like this
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "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": "npm run watch -- --watch-poll",
"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",
"prod": "npm run production",
"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.*",
"lodash": "^4.17.4",
"vue": "^2.1.10"
}
}
Related
I have created a new Laravel 7 project and after doing so, ran the command npm install and all the packages in my package.json were downloaded into the node_modules directory. Then i tried running the command npm run dev and keeps on failing.
I'm using the following versions
PHP 7.4.11
Laravel installer 4.11
Node v15.0.1
npm 7.0.3
Composer 2.0.9
This is my package.json file
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"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",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"autoprefixer": "^10.2.4",
"axios": "^0.21.1",
"cross-env": "^7.0.3",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.13",
"resolve-url-loader": "^3.1.0",
"sass": "^1.15.2",
"sass-loader": "^8.0.0",
"webpack": "^5.21.2",
"webpack-cli": "^4.5.0"
},
"name": "MyProject"
}
This is the error I get after running npm run watch or npm run dev
> dev
> npm run development
> development
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules -
-config=node_modules/laravel-mix
/setup/webpack.config.js
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "cross-env NODE_ENV=development
node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-
mix/setup/webpack.config.js"
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Rolling Sure\AppData\Local\npm-cache\_logs\2021-02-15T09_26_50_575Z-
debug.log
npm ERR! code 2
npm ERR! path C:\Users\Rolling Sure\Desktop\Code Fintech\duplicate\MyProject
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "npm run development"
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Rolling Sure\AppData\Local\npm-cache\_logs\2021-02-15T09_26_50_652Z-
debug.log
You could try reinstalling the node packages.
Delete the node_modules folder.
run npm install again
Im new to Laravel and wanted to use breeze authentication in my Laravel app.
I created my project and migrate my database tables then based on breeze tutorial I run
composer require laravel/breeze --dev
and
php artisan breeze:install
successfully. but I got these errors after running this code
npm install && npm run dev
and now its the result. can anyone help me?
F:\kishcharkh>npm install && npm run dev
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7(node_modules\chokidar\node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Invalid protocol: 127.0.0.1:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2
(node_modules\watchpack\node_modules\chokidar\node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Invalid protocol: 127.0.0.1:
> # dev F:\kishcharkh
> npm run development
> # development F:\kishcharkh
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js
Additional dependencies must be installed. This will only take a moment.
Running: npm install vue-template-compiler --save-dev --production=false
npm ERR! Invalid protocol: 127.0.0.1:
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\masih\AppData\Roaming\npm-cache\_logs\2021-01-12T09_52_45_253Z-debug.log
F:\kishcharkh\node_modules\webpack-cli\bin\cli.js:93
throw err;
^
Error: Command failed: npm install vue-template-compiler --save-dev --production=false
npm ERR! Invalid protocol: 127.0.0.1:
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\masih\AppData\Roaming\npm-cache\_logs\2021-01-12T09_52_45_253Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js`
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.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\masih\AppData\Roaming\npm-cache\_logs\2021-01-12T09_52_45_353Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
and here is the package.json file:
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"#tailwindcss/forms": "^0.2.1",
"alpinejs": "^2.7.3",
"autoprefixer": "^10.1.0",
"axios": "^0.19",
"cross-env": "^7.0",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.19",
"postcss": "^8.2.1",
"postcss-import": "^12.0.1",
"resolve-url-loader": "^3.1.0",
"tailwindcss": "^2.0.2"
}
}
I did fight with that one day ago. I discoverd that if the error persist after of:
rm -rf node_modules
rm package.lock.json
npm cache clear --force
npm install
npm run dev
Then the error was that my node was outdated. Update to lastest version
I've been using Laravel 8 beside Vue Js and they worked well together. I tried to start a project with Laravel and Vue Js again, but after a week it gave me an error. I used the commands below:
Laravel v8.26.1 (PHP v7.4.3)
composer create-project --prefer-dist laravel/laravel <project_name>
It works fine, after that:
npm install
Works well, too
But here's the error when I try running npm run dev
npm run dev
> # dev <project_path>
> npm run development
> # development <project_path>
> mix
Error: You are using an unspported version of Node. Please update to at least Node v12.14
at assertSupportedNodeVersion (<project_path>/node_modules/laravel-mix/src/Engine.js:6:15)
at executeScript (<project_path>/node_modules/laravel-mix/bin/cli.js:58:5)
at Command.program.command.description.option.action.cmd (<project_path>/node_modules/laravel-mix/bin/cli.js:44:13)
at Command.listener [as _actionHandler] (<project_path>/node_modules/commander/index.js:426:31)
at Command._parseCommand (<project_path>/node_modules/commander/index.js:1002:14)
at Command._dispatchSubcommand (<project_path>/node_modules/commander/index.js:953:18)
at Command._parseCommand (<project_path>/node_modules/commander/index.js:979:12)
at Command.parse <project_path>/node_modules/commander/index.js:801:10)
at Command.parseAsync (<project_path>/node_modules/commander/index.js:828:10)
at run (<project_path>/node_modules/laravel-mix/bin/cli.js:47:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `mix`
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2021-02-06T07_19_07_707Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2021-02-06T07_19_07_767Z-debug.log
package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies": {
"axios": "^0.21",
"bootstrap": "^4.0.0",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^6.0.6",
"lodash": "^4.17.19",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.20.1",
"sass-loader": "^8.0.0",
"vue": "^2.5.17",
"vue-router": "^3.4.9",
"vue-template-compiler": "^2.6.10"
},
"dependencies": []
}
I didn't do something special or configure anything!
Thanks in advance ;D
You have to upgrade your node so try these commands:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
check node version by:
sudo node -v
it must show something like v14.*
You may need to restart your terminal to see the updated node version.
And then do npm run dev
Ok. I'm taking a course on Laravel through udemy, and all the styling is done in sass. I followed the same steps as the instructor but I'm getting errors whereas his worked fine. Can someone please help. I'm on windows and he is on MAC
I installed Laravel using composer, then migrated my database tables.
The next thing we had to do was install node and stuff using
npm install
Here is where the problems lay. I did not get a node modules folder, whereas he did. To get a node modules folder I needed to run
npm install node-laravel
But the folders contained different contents.
After i added sass folders into laravel, and to compile them he ran
npm run watch
SASS compiled perfectly for him, whereas I got this error
> # watch C:\Users\andre\Dropbox\Code\Personal\CodingPhase\PHP-7\DesignSt
orm
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --wa
tch --progress --hide-modules --config=node_modules/laravel-mix/setup/web
pack.config.js
The system cannot find the path specified.
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn node_modules\webpack\bin\webpack.js ENOENT
at notFoundError (C:\Users\andre\AppData\Roaming\npm\node_modules\cro
ss-env\node_modules\cross-spawn\lib\enoent.js:11:11)
at verifyENOENT (C:\Users\andre\AppData\Roaming\npm\node_modules\cros
s-env\node_modules\cross-spawn\lib\enoent.js:46:16)
at ChildProcess.cp.emit (C:\Users\andre\AppData\Roaming\npm\node_modu
les\cross-env\node_modules\cross-spawn\lib\enoent.js:33:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198
:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: `cross-env NODE_ENV=development node_modules/webpack/bi
n/webpack.js --watch --progress --hide-modules --config=node_modules/lara
vel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # watch script.
npm ERR! This is probably not a problem with npm. There is likely additio
nal logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\andre\AppData\Roaming\npm-cache\_logs\2018-01-27T20
_14_57_489Z-debug.log
EDIT
This is the package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "node node_modules/cross-env/dist/bin/cross-env.js 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.*",
"lodash": "^4.17.4",
"vue": "^2.1.10"
},
"dependencies": {
"nodejs": "0.0.0"
}
}
npm install is the command that tells npm (Node Package Manager) to install the packages listed in package.json. The command npm install node-laravel tells npm to install the package node-laravel which is a "[...] Node.js library for inter-operating with Laravel.". Running npm install node-laravel is creating a node_modules folder because you're installing a package, but it's the wrong package: node-laravel is not what you're looking for.
The problem you're having is that npm install is not installing the dependencies listed in package.json so let's work through why that might be.
There are 2 types of dependencies listed in package.json, dependencies and devDependencies and as you can see from your package.json, all of your dependencies are in devDependencies. devDependencies are only installed when you're in a development environment, they are not installed in a production environment. This is (roughly) what happens:
You run npm install
npm installs everything listed in dependencies
npm determines what type of environment you're in
If you are in development npm will also install the packages listed in devDependencies
Your dependencies are listed as only nodejs so there is nothing for npm to install and therefore npm does not need to create a node_modules folder. Therefore, the problem you're having (npm is not installing packages listed in devDependencies) is most likely because npm believes you're in production.
There are 2 options:
You can keep you environment set to production and ask npm to install your devDependencies regardless by running npm install --only=dev
You can update your environment configuration to correctly set the environment to development by running npm config set -g production false then run npm install again
The second option is a solution to the problem, the first is a workaround. I recommend option 2.
Laravel Version: 5.4.21
PHP Version: 7.1.1
node v4.4.5
npm v4.5.0
npm commands are completely broken on windows (windows 7 in this case), whenever I run npm run dev I get the following error:
> # dev E:\xampp\htdocs\laravelblog
> npm run development
> # development E:\xampp\htdocs\laravelblog
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
E:\xampp\htdocs\laravelblog\node_modules\laravel-mix\setup\webpack.config.js:1
(function (exports, require, module, __filename, __dirname) { let path = require('path');
^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at requireConfig (E:\xampp\htdocs\laravelblog\node_modules\webpack\bin\convert-argv.js:96:18)
at E:\xampp\htdocs\laravelblog\node_modules\webpack\bin\convert-argv.js:109:17
at Array.forEach (native)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\winuser-pc\AppData\Roaming\npm-cache\_logs\2017-04-29T18_27_27_864Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script 'npm run development'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run development
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\winuser-pc\AppData\Roaming\npm-cache\_logs\2017-04-29T18_27_27_938Z-debug.log
I tried default package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "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": "npm run watch -- --watch-poll",
"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",
"prod": "npm run production",
"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.*",
"lodash": "^4.17.4",
"vue": "^2.1.10"
}
}
I also tried other helps from internet as well like this one
"scripts": {
"dev": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "node node_modules/cross-env/bin/cross-env.js 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": "node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
Guide me what's wrong here. Why it is not working
Everyone - if you're getting "cross-env" not found, do npm install cross-env -D, and then make sure that you update your npm scripts in package.json to reference cross-env, rather than the full node_modules path to cross-env.
I am facing the same problem and overcome
and ignore node version manager NVM
npm i -g yarn
and
yarn run dev