我必须运行PHP服务器并使用browserSync代理它,但是当我按节点提供服务时,我遇到了问题:
这是控制台日志:
[23:25:56] Starting 'serve'...
[23:25:56] Starting 'clean'...
[23:25:56] Finished 'clean' after 31 ms
[23:25:56] Starting 'image'...
[23:25:56] Starting 'webpack'...
[23:25:57] Version: webpack 1.15.0
Asset Size Chunks Chunk Names
site.js 5.71 kB 0 [emitted] site
site-gallery.js 3.75 kB 1 [emitted] site-gallery
site-home.js 11.2 kB 2 [emitted] site-home
.... several 404 ....
[23:25:57] Finished 'webpack' after 810 ms
[23:26:00] gulp-imagemin: Minified 175 images (saved 9.26 MB - 47.2%)
[23:26:00] Finished 'image' after 3.68 s
[23:26:00] Starting 'server'...
PHP 7.1.28 Development Server started at Sat Dec 14 23:26:01 2019
Listening on http://127.0.0.1:8888
Document root is ******/public
Press Ctrl-C to quit.
[Sat Dec 14 23:26:01 2019] 127.0.0.1:51385 [200]: /
[23:26:01] 'server' errored after 1.53 s
[23:26:01] Error: no parsers registered for: "]a(r)"
..../node_modules/snapdragon/lib/parser.js:473:15)
[23:26:01] 'serve' errored after 5.25 s
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! server@1.0.0 serve: `gulp serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the server@1.0.0 serve 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! /Users/uncoke/.npm/_logs/2019-12-14T22_26_01_845Z-debug.log
gulpfile.js
...
gulp.task('server', function() {
$.connectPhp.server({
base: pkg.directories.dist,
port: '8888'
}, function() {
browserSync({
proxy: 'localhost:8888',
port: '3000'
})
})
现在,如果我在http://localhost:8888/处打开浏览器,我会看到服务器已启动并正在运行,并且在控制台.log中它会显示日志。
注意:崩溃脚本仅需一秒钟,然后在浏览器上打开一个窗口,然后崩溃
怎么了?