MohamedLamineAllal / laravel-mix-glob

Laravel mix extension that add glob support.
MIT License
20 stars 6 forks source link

Erro npm run watch #4

Closed gravataLonga closed 4 years ago

gravataLonga commented 5 years ago

When i run npm run watch i get this error:

webpack is watching the files…

events.js:180
      throw er; // Unhandled 'error' event
      ^

Error: read ENOTCONN
    at WriteStream.Socket._read (net.js:530:20)
    at WriteStream.Readable.read (_stream_readable.js:474:10)
    at resume_ (_stream_readable.js:953:12)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
Emitted 'error' event at:
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:77:11) {
  errno: 'ENOTCONN',
  code: 'ENOTCONN',
  syscall: 'read'
}

But running the npm run dev, is totally fine!!

OS: Windows
NPM: 6.5.0
NODE: v12.7.0

Version of package installed:

        "laravel-mix": "^4.0.16",
        "laravel-mix-glob": "^1.1.2",

I think it's related to issue #2

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\user\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'development',
1 verbose cli   '--',
1 verbose cli   '--watch'
1 verbose cli ]
2 info using npm@6.5.0
3 info using node@v12.7.0
4 verbose run-script [ 'predevelopment', 'development', 'postdevelopment' ]
5 info lifecycle @0.0.1~predevelopment: @0.0.1
6 info lifecycle @0.0.1~development: @0.0.1
7 verbose lifecycle @0.0.1~development: unsafe-perm in lifecycle true
8 verbose lifecycle @0.0.1~development: PATH: C:\User\--user--\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\project\node_modules\.bin;C:\User\--user--\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\project\node_modules\.bin;node_modules\.bin\;C:\tools\cmder\bin;C:\tools\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\tools\cmder\vendor\conemu-maximus5;C:\tools\cmder\vendor\conemu-maximus5\ConEmu;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python37\Scripts\;C:\Python37\;C:\tools\ruby25\bin;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 (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\ProgramData\chocolatey\bin;C:\tools\php72;C:\ProgramData\ComposerSetup\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Go\bin;C:\User\--user--\.dnx\bin;C:\User\--user--\AppData\Local\Microsoft\WindowsApps;C:\User\--user--\AppData\Roaming\Composer\vendor\bin;C:\User\--user--\AppData\Roaming\npm;C:\tools\cmder;C:\User\--user--\go\bin;C:\User\--user--\AppData\Local\atom\bin;C:\User\--user--\AppData\Local\Yarn\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\share\vim\vim74;C:\tools\cmder\
9 verbose lifecycle @0.0.1~development: CWD: C:\CCSDEV\UTP\app.utp.pt
10 silly lifecycle @0.0.1~development: Args: [
10 silly lifecycle   '/d /s /c',
10 silly lifecycle   'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"'
10 silly lifecycle ]
11 silly lifecycle @0.0.1~development: Returned: code: 1  signal: null
12 info lifecycle @0.0.1~development: Failed to exec development script
13 verbose stack Error: @0.0.1 development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\User\--user--\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:203:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\User\--user--\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:203:13)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid @0.0.1
15 verbose cwd C:\CCSDEV\UTP\app.utp.pt
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\user\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "development" "--" "--watch"
18 verbose node v12.7.0
19 verbose npm  v6.5.0
20 error code ELIFECYCLE
21 error errno 1
22 error @0.0.1 development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"`
22 error Exit status 1
23 error Failed at the @0.0.1 development script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
MohamedLamineAllal commented 5 years ago

Hi @gravataLonga. Sorry for being late. I was too busy that i wasn't checking. Can you send me the package.json. I will investigate the problem. I don't think it's related to issue 2. As it revolve only around spawning npm process. Which is needed when restarting the watch. The issue 2 is fixed. A PR was provided by the one that issued it. And it was merged. We are using "cross-spawn" package. [still i will check]

If you can provide a repo that replicate the problem. It will be nice.

Otherwise i will investigate the possible cause. Test some hypotheses and come back.

Thank you.

acorsetti-conjurer commented 3 years ago

Hello, Sorry to reopen this. I'm facing the same error that @gravataLonga

I get this error when running npm run watch or npm run hot:

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: read ENOTCONN
    at tryReadStart (net.js:574:20)
    at WriteStream.Socket._read (net.js:585:5)
    at WriteStream.Readable.read (internal/streams/readable.js:481:10)
    at WriteStream.Socket.read (net.js:625:39)
    at resume_ (internal/streams/readable.js:968:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on WriteStream instance at:
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -4053,
  code: 'ENOTCONN',
  syscall: 'read'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@1.0.0 watch: `mix watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@1.0.0 watch 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\my.user\AppData\Roaming\npm-cache\_logs\2021-04-15T14_09_44_444Z-debug.log

But when I run npm run dev the error doesn't throw. And the files are compiled correctly as expected.

My environment is:

Thanks for this package, it is very useful!!

gravataLonga commented 3 years ago

The only way to resolve the problem was running as npm run watch-poll

acorsetti-conjurer commented 3 years ago

@gravataLonga thanks for the reply!

I tried but in my case it keeps showing the same error

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: read ENOTCONN
    at tryReadStart (net.js:574:20)
    at WriteStream.Socket._read (net.js:585:5)
    at WriteStream.Readable.read (internal/streams/readable.js:481:10)
    at WriteStream.Socket.read (net.js:625:39)
    at resume_ (internal/streams/readable.js:968:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on WriteStream instance at:
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -4053,
  code: 'ENOTCONN',
  syscall: 'read'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@1.0.0 watch-poll: `mix watch -- --watch-options-poll=1000`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@1.0.0 watch-poll 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\my.user\AppData\Roaming\npm-cache\_logs\2021-04-16T07_32_38_028Z-debug.log

I don't know where the error comes from. And the fact that the npm run dev works properly just confuses me...

@MohamedLamineAllal maybe it's really a bug with the current version watch option, if the watch command is known to work in older versions, I can use them for now. For me it is important that the watch works due to my project requirements.

gravataLonga commented 3 years ago

Sorry my bad, you need to change something in package.json too..

acorsetti-conjurer commented 3 years ago

OK, I downgraded to v1.1.0. Now watch and watch-poll options work, BUT it does not restart at file add, rename or remove. I will test this in a linux environment inside a vagrant machine later. :D