doucaigai7176 2015-09-24 00:50
浏览 57

为什么grunt-php路由器会忽略我的基本路径?

We have one Gruntfile.js that looks like this on my coworker's machine.

php: {
    dist: {
        options: {
            port: 8888,
            useAvailablePort: true,
            keepalive: true,
            router: '_router.php',
            base: 'src' //dev mode
        }
    }
},

...and it works fine on his machine but not mine. _router.php is at the top level directory. Running grunt dev leads into no errors in my console during dev deploy.

PHP 5.5.27 Development Server started at Wed Sep 23 17:31:54 2015
Listening on http://127.0.0.1:8888
Document root is /Users/toszter/Engineering/moo/sources/local/web/src
Press Ctrl-C to quit.
[Wed Sep 23 17:39:33 2015] 127.0.0.1:53910 Invalid request (Unexpected EOF)

Yet, I see in my browser at localhost:8888...

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required '_router.php' (include_path='.:') in Unknown on line 0

Changing the router property in the code above to router: 'src/_router.php' fixes the problem on my machine, but breaks everyone else.

So it stands needing a bit of explanation: Why do I need to re-specify the base directory explicitly in my router property and no one else on my team?

  • 写回答

1条回答 默认 最新

  • duanluo9369 2015-09-25 04:43
    关注

    Possibly because path.resolve isn't providing absolute paths to the php script spawned in the task by using the simple options given and options.base to join the true path to the router.

    While the task expects a full path to router inside spawn, it only gets the relative path from options.router inside php.js, which pukes rainbow unicorn sparkles everywhere.

    The original issue is here. That was eventually fixed here, and yet this problem persisted, so it now appears fixed here but not yet merged with grunt-php master.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度