I am currently performing these terminal commands:
composer create-project --prefer-dist laravel/laravel:^7.0
composer require laravel/ui:^2.4
php artisan ui bootstrap --auth
npm install && npm run dev
This returns the following error
sh: mix: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! # development: `mix`
npm ERR! spawn ENOENT
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/jonahmar/.npm/_logs/2021-02-23T15_46_54_252Z-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/jonahmar/.npm/_logs/2021-02-23T15_46_54_277Z-debug.log
I am unable to fix or identify the issue, I have performed the following in an attempt to fix the issue:
npm rebuild node-sass
npm install --global cross-env
npm cache clean --force
npm install laravel-mix --save-dev
To no avail, I am also getting a warning prior to running this command:
npm WARN lifecycle The node binary used for scripts is /home/jonahmar/nodevenv/onyx.website.io/12/bin/node but npm is using /opt/alt/alt-nodejs12/root/usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
The current web-server is Litespeed Enterprise, with the latest version of composer, and node.
{
"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",
"laravel-mix": "^6.0.6",
"lodash": "^4.17.19",
"postcss": "^8.1.14"
}
}
Related
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
I want to load vue Component in Public file using npm run watch , it gives me a message in watch dev or build ..?
Node.js v14.15.0.
npm 6.14.8
Laravel Installer 4.1.0
npm run watch
> # watch C:\Users\ANOOD\Desktop\Laravel&vueja\Laravel_vue
> npm run development -- --watch
> # development C:\Users\ANOOD\Desktop\Laravel&vueja\Laravel_vue
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
The system cannot find the path specified.
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn node_modules\webpack\bin\webpack.js ENOENT
at notFoundError (C:\Users\ANOOD\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\ANOOD\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\ANOOD\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess.cp.emit (C:\Users\ANOOD\AppData\Roaming\npm\node_modules\cross-env\node_modules\cross-spawn\lib\enoent.js:30:37)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn node_modules\\webpack\\bin\\webpack.js',
path: 'node_modules\\webpack\\bin\\webpack.js',
spawnargs: [
'--progress',
'--config=node_modules/laravel-mix/setup/webpack.config.js',
'--watch'
]
}
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 "--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.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ANOOD\AppData\Roaming\npm-cache\_logs\2020-11-10T12_23_34_863Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: `npm run development -- --watch`
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 additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ANOOD\AppData\Roaming\npm-cache\_logs\2020-11-10T12_23_35_071Z-debug.log
The problom was not on Laravel or npm or node_modules , simply it was the directory that I have been use when I put my laravel Project in Laravel every thing is ok but when I move it to another Directory calls Laravel&Vue it won't work and this problem apper.
I installed a vue on laravel7. But npm run dev gives this error:
# development: cross-env NODE_ENV=development
node_modules/webpack/bin/webpack.js --progress --hide-modules
--config=node_modules/laravel-mix/setup/webpack.config.js
I installed cross-env, cleared cache, reinstalled node_modules, installed webpack, but they did not resolve my problem.
Full version of error:
events.js:174 throw er; // Unhandled 'error' event ^
Error: spawn node_modules/webpack/bin/webpack.js ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19) at onErrorNT (internal/child_process.js:415:16) at process._tickCallback (internal/process/next_tick.js:63:19) at Function.Module.runMain (internal/modules/cjs/loader.js:834:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3) Emitted 'error' event at: at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12) at onErrorNT (internal/child_process.js:415:16) [... lines matching original stack trace ...] at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3) 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. 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/alibek/.npm/_logs/2020-03-16T19_56_59_915Z-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.lal
I resolved this probled:
npm install webpack-cli
npm install
npm install --dev or npm install --only=dev
I am getting below error while running
'npm run dev'
command.
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --p
rogress --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! 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" "watch"
npm ERR! node v6.11.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! # watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpa
ck.js --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 node_modul
es/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_module
s/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
--watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpac
k.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.
Can anybody tell me what is the issue here?
Thanks
I've had the same issue recently after upgrading Laravel app. You just need to install the package:
npm install cross-env
First you need to perform the following steps
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install --global cross-env
npm install
Then try restarting your terminal and make sure you are not using the integrated terminal (e.g on visual studio code) when running "npm run dev". Instead, try running the "npm run dev" command on a different powershell terminal window. Works for me everytime.