成功编译成功后,Webpack监视脚本会抛出错误.Laravel Homestead

时间:2017-12-01 05:39:33

标签: laravel webpack homestead mix

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 ]

我不知道为什么会发生这种情况,我正在使用流浪汉和虚拟盒子,但这会在我的机器上编译,而不是在虚拟机器上。我得到这个&#34;未知错误&#34;在随机文件上。

我尝试了什么:

  1. 删除/重新安装node_modules
  2. 升级节点和NPM
  3. 清除NPM缓存
  4. 操作系统:Windows 7
    Laravel: 5.4v
    NPM: 5.5.1v

3 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

我合并了git branch后问题就消失了。我不知道它是什么。

答案 2 :(得分:0)

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

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