Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sjess's avatar
Level 15

npm run watch in infinite loop (Laravel 5.4)

Hi there,

I have following error when using npm run watch on latest Laravel 5.4:

 95% emittingError: EBUSY: resource busy or locked, open 'D:\repositories\entwicklung\urlshortener\public\images\bg.jpg'
    at Error (native)

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\s.jess\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch"
npm ERR! node v6.9.5
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `node node_modules/cross-env/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`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script 'node node_modules/cross-env/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'.
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 --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:\Users\s.jess\AppData\Roaming\npm-cache\_logs\2017-02-17T10_07_34_771Z-debug.log

And I try to compile this little sucker ;)

body {
    height: 100%;
    background: url('../images/bg.jpg') repeat-y top left;
}

Funny detail: npm run dev is working, but watch is doing nothing, just run in infinite loop and spreading tons of notifications.

Node and npm are the latest versions.

Any suggestions?

Regards

0 likes
6 replies
notflip's avatar

Did you find a solution to this? I also have the loop issue but without errors

2 likes
sjess's avatar
Level 15

The link above fixed my problem, cuz I didn't know exactly how to handle images in css with laravel-mix.

zeshan77's avatar

The following piece of code fixed my problem:

// webpack.mix.js

mix.options({
    processCssUrls: false
})
1 like
xeisu's avatar

This issue seems like it can have multiple error sources. In my case I it was relevant to Tailwind CSS and the purge option. I don't remember exactly what package I have installed but I copy pasted the following to my tailwind.config.js:

module.exports = {
    mode: 'jit',
    purge: {
        content: [
            './public/**/*.html',

After I have removed the line './public/**/*.html', it worked.

Please or to participate in this conversation.