【问题标题】:404 Not found error when tring to access local.wordpress.dev尝试访问 local.wordpress.dev 时出现 404 Not found 错误
【发布时间】:2016-03-09 08:37:32
【问题描述】:

我正在尝试在 Windows 机器上设置 Varying Vagrant Vagrants 以进行 WordPress 开发。

我正在运行 Windows 8.1 Pro 64 位操作系统并安装了 Virtual Box 5.0 和 Vagrant 1.8.1。

在命令提示符中执行vagrant up --provision 行后,我收到以下错误,然后在尝试访问local.wordpress.dev 时,会显示404 Not Found

==> default: Initializing grunt in WordPress develop... This may take a few mome
nts.
==> default: >> Local Npm module "grunt-browserify" not found. Is it installed?
==> default: Loading "sass.js" tasks...
==> default: ERROR
==> default: >> Error: The `libsass` binding was not found in /srv/www/wordpress
-develop/node_modules/node-sass/vendor/linux-x64-11/binding.node
==> default: >> This usually happens because your node version has changed.
==> default: >> Run `npm rebuild node-sass` to build the binding for your curren
t node version.
==> default: Running "clean:all" (clean) task
==> default: >> 0 paths cleaned.
==> default: Running "copy:files" (copy) task
==> default: Created 142 directories
==> default: , copied 1247 files
==> default: Running "copy:wp-admin-css-compat-rtl" (copy) task
==> default: Copied 1 file
==> default: Running "copy:wp-admin-css-compat-min" (copy) task
==> default: Copied 2 files
==> default: Running "copy:version" (copy) task
==> default: Copied 1 file
==> default: Running "cssmin:core" (cssmin) task
==> default: >> 36 files created. 634.73 kB → 535.78 kB
==> default: Warning: Task "sass:colors" not found. Use --force to continue.
==> default: Aborted due to warnings.
==> default:
==> default: VVV custom site import
==> default: Cleaning the virtual machine's /etc/hosts file...
==> default: Adding domains to the virtual machine's /etc/hosts file...
==> default:  * Added vvv.dev from /srv/www/vvv-hosts
==> default:  * Added local.wordpress.dev from /srv/www/vvv-hosts
==> default:  * Added local.wordpress-trunk.dev from /srv/www/vvv-hosts
==> default:  * Added src.wordpress-develop.dev from /srv/www/vvv-hosts
==> default:  * Added build.wordpress-develop.dev from /srv/www/vvv-hosts
==> default: -----------------------------
==> default: Provisioning complete in 2911 seconds
==> default: For further setup instructions, visit http://vvv.dev
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: mysql stop/waiting
==> default: mysql start/running, process 28333
==> default: Running provisioner: shell...
    default: Running: inline script
==> default:  * Restarting nginx nginx
==> default:    ...done.

请注意:我使用以下内容手动修改了主机文件

192.168.50.4 vvv.dev local.wordpress.dev local.wordpress-trunk.dev src.wordpress-develop.dev build.wordpress-develop.dev

issue 已在 VVV GitHub 页面上报告。

是否有任何与 Windows 相关的东西导致上述错误并给出 404?我对 Vagrant 和 VVV 完全陌生,非常感谢您的帮助。

【问题讨论】:

  • 你的运行状况如何vagrant up --provision - Cygwin?仅供参考,--provision 标志可能是不必要的,至少在第一次启动时是这样,因为vagrant up 将自动配置该框。
  • 我第一次尝试使用vagrant up 并收到相同的错误。下次我尝试使用vagrant up --provision

标签: vagrant vvv-wordpress


【解决方案1】:

我不能肯定这个问题与您的主机 (Windows) 相关,因为不清楚该框是如何启动的。我也有一段时间没有使用VVV了。但是,您的主机似乎与该问题无关。

出于故障排除的目的,这里确实有两个问题,可能相关也可能不相关。

  1. 您的问题中指出的错误来自grunt,来宾(虚拟机内的操作系统)上的node/npm 包无法加载它需要的包。

  2. 网络服务器(正在工作,因为它返回 404)没有提供您期望的文件。

我相信您的问题源于grunt 无法运行准备服务器所需的所有任务,尽管目前尚不清楚原因。如果您对命令行感到满意,您可以 ssh 进入来宾并尝试手动运行 grunt 任务并安装任何可能丢失的包。

为此,您需要找到包含Gruntfile.jspackage.json 文件的目录。从那里运行

npm install

希望所有的软件包都能正确安装。如果您重新启动来宾,一切都应该工作。如果包没有正确安装,至少你应该对出了什么问题有一个更好的了解。

【讨论】:

  • 感谢@Brian Morton,我会试用并通知您。
  • 特别感谢@Brian Morton 花时间研究我遇到的问题并提出答案。非常感谢。
  • 啊太棒了 - 我很高兴能帮上忙。我总是忘记建议确保基于 Windows 的命令行以管理员身份运行。
【解决方案2】:

最后,我解决了我报告的问题。

Windows 用户必须使用vagrant up --provision,这解决了问题。确保以管理员身份运行命令提示符。

类似的问题是 GitHub 中的 reported 并以这种方式解决。

更新:如果您安装了 WampServer 或 Xampp,请在安装 VVV 之前将其卸载。

【讨论】:

    猜你喜欢
    • 2017-10-19
    • 2012-09-27
    • 1970-01-01
    • 1970-01-01
    • 2019-08-02
    • 1970-01-01
    • 1970-01-01
    • 2019-01-28
    • 2011-05-02
    相关资源
    最近更新 更多