node -v): v7.4.0npm -v): 4.0.5https://github.com/kentcdodds/cross-env/commit/aae44dff49494912a76423a7e45d3d1afd630e4a updated the path for the cross-env.js file to node_modules/cross-env/dist/bin/cross-env.js
Needs update in https://github.com/laravel/laravel/blob/master/package.json
Install mix (npm install) and try to run npm run dev.
$ npm run dev
> @ dev C:\Users\Alexander Jank\Projekte\api.backtoup.de
> node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=n
ode_modules/laravel-mix/setup/webpack.config.js
module.js:472
throw err;
^
Error: Cannot find module 'C:\Users\Alexander Jank\Projekte\api.backtoup.de\node_modules\cross-env\bin\cross-env.js'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! @ dev: `node node_modules/cross-env/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-mod
ules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script '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'.
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! 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
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! C:\Users\Alexander Jank\Projekte\api.backtoup.de\npm-debug.log
My npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle @~predev: @
6 silly lifecycle @~predev: no script for predev, continuing
7 info lifecycle @~dev: @
8 verbose lifecycle @~dev: unsafe-perm in lifecycle true
9 verbose lifecycle @~dev: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\Alexander Jank\Projekte\api.backtoup.de\node_modules\.bin;C:\Users\Alexander Jank\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Alexander Jank\bin;C:\Program Files\ImageMagick-7.0.4-Q16;C:\Program Files (x86)\ImageMagick-7.0.3-Q16;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\PuTTY;C:\Program Files (x86)\WinSCP;C:\Program Files (x86)\GNU\GnuPG\pub;C:\ProgramData\ComposerSetup\bin;C:\Program Files\cURL\bin;C:\Program Files\Git LFS;C:\Program Files (x86)\Paragon Software\Paragon ExtFS for Windows;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\DTS\Binn;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\NTP\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\Git\cmd;C:\Program Files\Java\jdk1.8.0_102\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Go\bin;C:\Program Files\Wireshark;C:\Program Files\nodejs;C:\Program Files (x86)\Skype\Phone;C:\Users\Alexander Jank\AppData\Local\Programs\Python\Python35-32\Scripts;C:\Users\Alexander Jank\AppData\Local\Programs\Python\Python35-32;C:\ImageMagick-6.9.3-7;C:\xampp\php;C:\xampp\php\ext;C:\Users\Alexander Jank\AppData\Roaming\Composer\vendor\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\FFmpeg\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\Nmap;C:\Program Files\Hugo\bin;C:\Program Files\Ansicon;C:\xampp\mysql\bin;C:\xampp\php\extras\openssl;C:\Users\Alexander Jank\Projekte\gospace\bin;C:\Users\Alexander Jank\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
10 verbose lifecycle @~dev: CWD: C:\Users\Alexander Jank\Projekte\api.backtoup.de
11 silly lifecycle @~dev: Args: [ '/d /s /c',
11 silly lifecycle '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' ]
12 silly lifecycle @~dev: Returned: code: 1 signal: null
13 info lifecycle @~dev: Failed to exec dev script
14 verbose stack Error: @ 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`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:885:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid @
16 verbose cwd C:\Users\Alexander Jank\Projekte\api.backtoup.de
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
19 error node v7.4.0
20 error npm v4.0.5
21 error code ELIFECYCLE
22 error @ 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`
22 error Exit status 1
23 error Failed at the @ dev script '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'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error 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
23 error You can get information on how to open an issue for this project with:
23 error npm bugs
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
I would suggest updateing the path for the npm run-commands in https://github.com/laravel/laravel/blob/master/package.json.
With updated paths it works as expected.
Few issues with this and Yarn laravel/laravel/pull/4162;
Error: Cannot find module '/Users/bashy/Sites/name/node_modules/cross-env/dist/bin/cross-env.js'
You just need to update the cross-env path in your package.json file.
Or, if you're on a Mac, delete the cross-env path entirely. It's only necessary for Windows users.
Hey guys, is there a secret to getting Laravel Mix (Laravel 5.4) to work on Ubuntu?
I am getting the same error Error: Cannot find module '/media/justin/STORAGE/dev/code/bookme.justinc.dev/node_modules/cross-env/bin/cross-env.js'.
I have tried updating the cross-env path to node_modules/cross-env/bin/dist/cross-env.js but that produces the error: Error: Cannot find module '../dist'.
I have also tried deleting the cross-env path from scripts.dev in my package.json but then I get an error: SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode due to the let at the top of node_modules/laravel-mix/setup/webpack.config.js
I get these errors when I run npm run dev. I've made sure that I am editing the scripts.dev property in package.json
Any help would be greatly appreciated.
If you've not tried yet:
Run purge your node_modules directory and run npm install again.
Afterwars you may also try to npm rebuild <package> if it sort of looks like one or more packages aren't working.
@jankal - Thanks for the quick reply.
EDIT: Problem was due to a combination of incorrect cross-env path in package.json AND an outdated version of NPM (3.5.2) that is globally installed. Resolving the NPM version issue allowed me to implement @JeffreyWay suggestion above and that fixed it. Thanks again for your assistance.
@JeffreyWay What do you think about this? Maybe another bug or just user config related?
@justincdotme What system are you using? What version of NPM, Laravel and so on?
- Laravel Mix Version: x.y.z
- Node Version (`node -v`): x.y.z
- NPM Version (`npm -v`): x.y.z
- OS: ?
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"
I got that too after add dist
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
Updating node from 4.x to latest fixed this for me.
same error here,
windows 10 64bits
"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"
I tried to change composer.json but it doesn't work for me
my previous composer.json errors
$ npm run watch
@ watch C:xampp\htdocs\LaraBook
cross-env NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "watch"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ watch: cross-env NODE_ENV=development webpack --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script 'cross-env NODE_ENV=development webpack --watch --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 webpack --watch --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! C:xampp\htdocs\LaraBooknpm-debug.log
It looks like your NPM version is outdated. Try updating that and see if it solves the problem.
Thanks a lot .it works as you said
On 5 Aug 2017 14:39, "Robert Doucette" notifications@github.com wrote:
It looks like your NPM version is outdated. Try updating that and see if
it solves the problem.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/JeffreyWay/laravel-mix/issues/521#issuecomment-320430911,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARdHkFUNF9xLBEM4wN7hc-7uHISz4dl3ks5sVCpGgaJpZM4MTOmV
.
You just need to update the cross-env path in your package.json file.
Or, if you're on a Mac, delete the cross-env path entirely. It's only necessary for Windows users.
Hello, Im not sure If Im removing cross-env correctly how would remove them? I have the same problem with a fresh Laravel 7 Install Im using Mac. I tried like this:
`{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "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": "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": "NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.19",
"bootstrap": "^4.0.0",
"jquery": "^3.2",
"laravel-mix": "^5.0.1",
"lodash": "^4.17.13",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.20.1",
"sass-loader": "^8.0.0",
"vue": "^2.5.17",
"vue-template-compiler": "^2.6.10"
}
}
`
But it didn't work, I have another laravel project in another folder where npm runs. I tried using that package.json and it didn't work. Any ideas? Thanks in advance
It looks like you are not referencing cross-env in your package.json file so I don't think the problem is coming from that. Would you be able to provide more information about any errors your seeing?
After 2 days of suffering. I left everything out of the box but changed my Node version (I had 13 I changed it to 10) and now npm works! Thanks :)
Glad you got it figured out!
Most helpful comment
cross-env must have updated its paths, it has "cross-env/dist/bin" not "cross-env/bin/"
in package.json
(EDIT)