Description:
When running npm run dev or yarn run dev (tried with both using fresh installs) get the following error below. Tried a bunch of stuff including:
Error: Cannot find module '{{Location to Project}}/node_modules/cross-env/bin/cross-env.js'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I had the same problem. The error says it can't find the module "node_modules/cross-env/bin/cross-env.js". If you check the directory is actually "node_modules/cross-env/dist/bin/cross-env.js". What you can do is change that directory on the scripts on package.json. Or another thing that worked for me was to change "node node_modules/cross-env/bin/cross-env.js" on the scripts for simply "cross-env" just like @JeffreyWay does it in this repo.
cross-env must have updated its paths, it has "cross-env/dist/bin" not "cross-env/bin/"
in package.json
(EDIT)
"dev": "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": "node node_modules/cross-env/dist/bin/cross-env.js 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": "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",
"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"
Thanks its works
Most helpful comment
cross-env must have updated its paths, it has "cross-env/dist/bin" not "cross-env/bin/"
in package.json
(EDIT)