davy_yg's avatar
Level 27

npm run dev error

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.

I am getting this error message and trying to fix it:

This is what I did:

delete vendor delete node_modules

npm install composer install npm run dev

It does not works!

ref: https://github.com/JeffreyWay/laravel-mix/issues/1072

I am using Win 10. There is no way to install a fresh new laravel since I have a big project. It will takes a long time to do that.

0 likes
18 replies
Sinnbeck's avatar

Notice this

There is likely additional logging output above.

Please post the actual error :)

mustafaxpp's avatar

hello, can you help me to solve this problem?

21 error code ELIFECYCLE 22 error syscall spawn bash 23 error file bash 24 error path bash 25 error errno -4058 26 error @ dev: npm run development 26 error spawn bash ENOENT 27 error Failed at the @ dev script. 27 error This is probably not a problem with npm. There is likely additional logging output above

...

topvillas's avatar

Have you tried the solution offered in the issue?

1 like
davy_yg's avatar
Level 27

C:/Users/ACER/AppData/Roaming/npm-cache/logs/2019-11-29T1304_05_357Z-debug.log C:\Users\ACER\AppData\Roaming\npm-cache_logs\2019-11-29T13_04_05_465Z-debug.log

https://drive.google.com/open?id=1TbWL-pu6_GMnGiHA_8UHV0I1MOSC2z1J

https://drive.google.com/open?id=13Ak88ALryLuA7nLBaSYkJlonjt9dElA3

I am using Windows and also gitlab. Should I reinstalled a fresh new laravel project? I also do not know which file to copy if I copy the whole files then what's the point? Please advice if anyone can help me solve the issue by seeing the error message.

Sinnbeck's avatar

Please at the very least wrap that in code tags ```. It is completely unreadable.

But better yet... try to see the actual error. Run the command and when it fails, scroll up and loop for something think this (taken from the link you posted)

https://imgur.com/WQItY9D

Sinnbeck's avatar

It seems that friendly-errors-webpack-plugin isnt loaded.. Is this a very old laravel project or something?

It should be in node_modules/laravel-mix/package.json

"friendly-errors-webpack-plugin": "^1.6.1",
Sinnbeck's avatar

It could be caused by your installed packages being bad.

Try this

npm cache clean --force
rm -rf node_modules
npm install
npm run dev
davy_yg's avatar
Level 27

Under which brackets? laravel-mix/package.json have a lot of brackets:

"dependencies": {

?

D:\xampp2\htdocs\sesa_final\sesa-e-commerce>rm -rf node_modules 'rm' is not recognized as an internal or external command, operable program or batch file.

Sinnbeck's avatar

sorry just though you were switching to linux

I think its called like this on windows

rmdir node_modules
davy_yg's avatar
Level 27

D:\xampp2\htdocs\sesa_final\sesa-e-commerce>rmdir node_modules

The directory is not empty.

davy_yg's avatar
Level 27

Did these:

npm cache clean --force
delete node_modules (manually)
npm install
npm run dev

Still the same errors :

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.

Sinnbeck's avatar

Yes it might not fix the actual issue but you might be able to see the error above now.

davy_yg's avatar
Level 27

I finally found the problem:

webpack.mix.js

.styles('resources/css/test.css', 'public/css')
.version();

I think the .styles might cause problem. After I deleted both of them it works. Any clue why?

Tray2's avatar

One of the files where used by another process and could not be overwritten or some permission issue probably. I think you really need to learn more Windows and linux basics before you continue your career as a developer.

davy_yg's avatar
Level 27

You mean cannot create test.css in public/css folder? See I login as Admin and as admin the permission is full control, only user that has read only permission.

It doesn't make sense.

Tray2's avatar

Sure it does. The Admin user does not have full access to another users files. And just because you are admin does not mean that every program you run are run as admin. To do that you need to do a run as admin.

So if the files in a folder requires admin access then you need to run npm as admin which is really not a good idea. I'm guessing you are using Windows 10 where Microsoft really fubared everything that has to do with permissions.

amel-le's avatar

i had the same problem this two days and now i solved it thnks guys, the solution was to run the cmd as administrator.

Please or to participate in this conversation.