【问题标题】:Webpack watch script throws an error after couple successfull compiles.Laravel Homestead成功编译后,Webpack 监视脚本抛出错误。Laravel Homestead
【发布时间】:2017-12-01 05:39:32
【问题描述】:

Bundle 编译成功了几次,但是我得到了这个错误:

错误:

95% emittingError: UNKNOWN: unknown error, open 'D:\Web Development\Projects\GUIRebuild\public\js\super_admin_bundle.js
'
    at Error (native)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `cross-env 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.
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\Smolen\AppData\Roaming\npm-cache\_logs\2017-12-01T05_07_28_612Z-debug.log

日志:

0 info it worked if it ends with ok
1 verbose cli [ 'D:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\Smolen\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'watch' ]
2 info using npm@5.5.1
3 info using node@v6.11.3
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle @~prewatch: @
6 info lifecycle @~watch: @
7 verbose lifecycle @~watch: unsafe-perm in lifecycle true
8 verbose lifecycle @~watch: PATH: C:\Users\Smolen\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;D:\Web Development\Projects\GUIRebuild\node_modules\.bin;%SystemRoot%\system32\WindowsPowerShell\v1.0\;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\PC Connectivity Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;D:\HashiCorp\Vagrant\bin;D:\Program Files\Git\cmd;D:\Program Files\nodejs\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\ProgramData\chocolatey\bin;C:\Program Files\Lenovo\Bluetooth Software\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;D:\Program Files (x86)\PuTTY\;C:\Users\Smolen\AppData\Local\atom\bin;C:\Users\Smolen\AppData\Roaming\npm;D:\Users\Smolen\AppData\Local\Android\sdk\platform-tools;
9 verbose lifecycle @~watch: CWD: D:\Web Development\Projects\GUIRebuild
10 silly lifecycle @~watch: Args: [ '/d /s /c',
10 silly lifecycle   'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
11 silly lifecycle @~watch: Returned: code: 1  signal: null
12 info lifecycle @~watch: Failed to exec watch script
13 verbose stack Error: @ watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\Smolen\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at EventEmitter.emit (events.js:191:7)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\Smolen\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at ChildProcess.emit (events.js:191:7)
13 verbose stack     at maybeClose (internal/child_process.js:920:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid @
15 verbose cwd D:\Web Development\Projects\GUIRebuild
16 verbose Windows_NT 6.1.7601
17 verbose argv "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Smolen\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch"
18 verbose node v6.11.3
19 verbose npm  v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error @ watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
22 error Exit status 1
23 error Failed at the @ watch script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

我不知道为什么会发生这种情况,我使用的是 vagrant 和 virtual box,但它在我的机器上编译而不是在虚拟机器上编译。我在随机文件上收到这个“未知错误”。

我尝试过的:

  1. 删除/重新安装 node_modules
  2. 升级节点和 NPM
  3. 清除 NPM 缓存

操作系统: Windows 7
Laravel: 5.4v
NPM: 5.5.1v

【问题讨论】:

    标签: laravel webpack homestead laravel-mix


    【解决方案1】:

    您可以尝试删除 node_modules 文件夹并再次运行 npm install

    【讨论】:

      【解决方案2】:

      在我的情况下,输出目录已损坏并且无法再打开,因此 webpack 无法访问它。

      通过在另一个位置签出项目来解决这个问题是最快的解决方案,因为删除目录并不容易,并且需要使用 Windows 修复工具修复驱动器(右键单击驱动器上的文件管理器 -> 属性 ->工具 -> 磁盘检查)。

      【讨论】:

      • 正是我的情况。谢谢!
      猜你喜欢
      • 2019-06-29
      • 2018-08-23
      • 2018-06-11
      • 2019-09-14
      • 1970-01-01
      • 1970-01-01
      • 2020-06-25
      • 1970-01-01
      • 2023-02-15
      相关资源
      最近更新 更多