如何正确复制工作中的 Laravel 4 项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16053297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 07:42:46  来源:igfitidea点击:

How to properly duplicate a working Laravel 4 project

laravellaravel-4composer-php

提问by tolgamorf

I have the latest Laravel 4 beta 5 build from Laravel's github repo.

我有来自 Laravel 的github repo的最新 Laravel 4 beta 5 版本。

I have built a simple web API and it is working fine. I wanted to duplicate the project to another folder and continue working on it from the copy. However, when I try that, I get the following error message:

我已经构建了一个简单的 Web API,并且运行良好。我想将项目复制到另一个文件夹并继续从副本中处理它。但是,当我尝试这样做时,我收到以下错误消息:

InvalidArgumentException
Driver [native] not supported.

/Users/tolga/Sites/l4api-copy/bootstrap/compiled.php
    Line 10908: throw new \InvalidArgumentException("Driver [{$driver}] not supported.");

Here is what I did in order to copy the project:

这是我为了复制项目所做的:

[?/Users/tolga/Sites] $ cp -R l4api l4api-copy
[?/Users/tolga/Sites] $ chmod -R 755 l4api-copy

It didn't work, so I've tried:

它没有用,所以我试过:

[?/Users/tolga/Sites] $ chmod -R 777 l4api-copy/app/storage

Still no good, tried to run composer dump-autoload:

还是不行,尝试运行 composer dump-autoload:

[?/Users/tolga/Sites] $ cd l4api-copy
[?/Users/tolga/Sites/l4api-copy] $ composer.phar dump-autoload
 Generating autoload files

[?/Users/tolga/Sites/l4api-copy] $

Same error. I have also tried to remove the app/storagefolder and re-create it.

同样的错误。我还尝试删除该app/storage文件夹并重新创建它。

[?/Users/tolga/Sites/l4api-copy] $ rm -Rf app/storage
[?/Users/tolga/Sites/l4api-copy] $ mkdir app/storage
[?/Users/tolga/Sites/l4api-copy] $ chmod -R 777 app/storage/

Here is a brand-new error:

这是一个全新的错误:

ErrorException

Warning: file_put_contents(/Users/tolga/Sites/l4api-copy/bootstrap/../app/storage/meta/services.json):
failed to open stream: No such file or directory in
    /Users/tolga/Sites/l4api-copy/bootstrap/compiled.php line 5507

        Line 5507: return file_put_contents($path, $contents);

I have also run composer.phar dump-autoloadcommand again, after emptying the app/storagefolder.

composer.phar dump-autoload清空app/storage文件夹后,我也再次运行命令。

And finally, I have also tried composer.phar install:

最后,我也尝试过composer.phar install

[?/Users/tolga/Sites/l4api-copy] $ composer.phar install
 Loading composer repositories with package information
 Installing dependencies from lock file
 Nothing to install or update
 Generating autoload files

[?/Users/tolga/Sites/l4api-copy] $

None of the above helped. What am I doing wrong? What is the proper way to duplicate a working project?

以上都没有帮助。我究竟做错了什么?复制工作项目的正确方法是什么?

回答by Jason Lewis

After a recent committo the laravel/laravelrepository a new session driver, native, has been introduced. From the looks of your errors you should update your application skeleton (the cloned develop branch of laravel/laravel), delete your bootstrap/compiled.phpfile and re-run composer updateto pull in the latest framework changes.

最近提交laravel/laravel存储库之后native,引入了一个新的会话驱动程序。从你的错误来看,你应该更新你的应用程序框架(laravel/laravel 的克隆开发分支),删除你的bootstrap/compiled.php文件并重新运行composer update以获取最新的框架更改。

In terms of copying the project you should copy over everything exceptthe vendordirectory then run composer installin the new location. You could copy the vendordirectory but it's better to run a clean install and let composer dump a new autoload.

在复制项目方面,您应该复制vendor目录之外的所有内容,然后composer install在新位置运行。您可以复制vendor目录,但最好运行全新安装并让 composer 转储新的自动加载。

I've also seen Taylor mention a cleanup of your app/storage/sessionsdirectory. Delete all the files in there.

我还看到 Taylor 提到要清理您的app/storage/sessions目录。删除里面的所有文件。