Laravel-Mix 8 with run watch - php

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.

Related

Laravel 7: Unable to Run Dev on Fresh Install

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"
}
}

npm - error in main, module not found - new laravel (8) app

Complete Laravel newbie here but I've googled for the past hour with no luck.
I've installed Laravel via composer (everything was working with the default set up) but I wanted to use bootstrap so I've installed npm, followed this guide here but when I run npm run dev I get an error:
Error in main
Module not found: Error: Can't resolve './src' in
'C:\xampp\htdocs...'
*Edited to include the rest of the error
webpack 5.3.1 compiled with 1 error in 69 ms
npm ERR! code 1
npm ERR! path C:\xampp\htdocs\laravelapp
npm ERR! command failed
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\user\AppData\Local\npm-cache\_logs\2020-10-29T14_19_55_826Z-debug.log
npm ERR! code 1
npm ERR! path C:\xampp\htdocs\laravelapp
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\user\AppData\Local\npm-cache\_logs\2020-10-29T14_19_55_857Z-debug.log
Has anyone come across this before?

Installing vue on new version of laravel7

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

Laravel getting error in npm run dev command

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.

Vuejs code change does not appear in website

I developed laravel 5.4 project, and then hosted it, and I setup nodejs and other packages on server, but when edit in vuejs code, the change does not appear in the website.
I also run npm run dev but it shows error for me this is error:
npm ERR! code ELIFECYCLE
npm ERR! errno 126
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 126
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.

Categories