Importante

Você está vendo a versão anterior da nova experiência da Alura que estamos preparando para você. Em breve, ela ganha uma identidade visual novinha totalmente pensada em potencializar seus estudos!

10
respostas

Novo projeto Laravel não inicia

Olá, após alguns problemas, consegui instalar tudo, acredito que corretamente, e consegui criar o projeto "estoque"...

porém, quando executo o comando no terminal, dentro da pasta do projeto: php artisan serve o seguinte erro é exibido:

require(/home/jdalri/Workspace/Studies/Laravel/estoque/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/jdalri/Workspace/Studies/Laravel/estoque/bootstrap/autoload.php on line 17 PHP Stack trace: PHP 1. {main}() /home/jdalri/Workspace/Studies/Laravel/estoque/artisan:0 PHP 2. require() /home/jdalri/Workspace/Studies/Laravel/estoque/artisan:16 PHP Fatal error: require(): Failed opening required '/home/jdalri/Workspace/Studies/Laravel/estoque/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php') in /home/jdalri/Workspace/Studies/Laravel/estoque/bootstrap/autoload.php on line 17 PHP Stack trace: PHP 1. {main}() /home/jdalri/Workspace/Studies/Laravel/estoque/artisan:0 PHP 2. require() /home/jdalri/Workspace/Studies/Laravel/estoque/artisan:16

não sei o que pode estar errado?

10 respostas

você rodou o comando composer install dentro do projeto ?

Oi Alan, não, só mexi com composer pra i stalar o laravel em si.

Qual seria esse comando que tenho de executar dentro da pasta do projeto?

Dentro da pasta do projeto pelo terminal você vai usar o comando composer install

Olá José, tudo bom?

Consegui resolver o erro, é preciso executar o comando composer install dentro da pasta do projeto, mas vai aparecer vários erros na instalação do composer, porque é necessário algumas extensões do PHP executei os seguintes comandos:

$sudo apt-get update
$ sudo apt-get install php-mbstring
$ sudo apt-get install libnet-libidn-perl 
$ sudo apt-get install php-all-dev 
$ sudo apt-get install php-cgi 
$ sudo apt-get install php-cli 
$ sudo apt-get install php-common 
$ sudo apt-get install php-curl 
$ sudo apt-get install php-dev 
$ sudo apt-get install php-gd 
$ sudo apt-get install php-gmp

Apos você executar os comandos acima execute o comando composer install dentro da pasta do projeto, agora se você tentar rodar o comando php artisan serve vai funcionar normalmente.

Se seu erro foi solucionado, não esquece de marcar a resposta como solucionada, assim você ajuda outras pessoas que tiverem a mesma dúvida.

Abraço!

Olá, segui os passos que você descreveu, mas continuo com o mesmo erro, dizendo que o autoload.php não exite...

Qual é a versão do seu PHP?

rodei php -i no meu terminal e o resultado foi:

PHP Version => 7.1.0RC2

Execute os seguintes comandos no terminal:

$ cd
$ composer create-project laravel/laravel estoque "5.0"
$ cd estoque
$ php artisan serve

Funcionou, caso aconteça algum erro, mostre a mensagem de erro


fagnersouza@fagnersouza-note:~/Projetos-Laravel/estoque$ sudo apt-get install php-mbstring libnet-libidn-perl php-all-dev php-cgi php-cli php-common php-curl php-dev php-gd php-gmp Lendo listas de pacotes... Pronto Construindo árvore de dependênciasLendo informação de estado... Pronto libnet-libidn-perl is already the newest version (0.12.ds-2build2). php-all-dev is already the newest version (1:35ubuntu6). php-cgi is already the newest version (1:7.0+35ubuntu6). php-cli is already the newest version (1:7.0+35ubuntu6). php-common is already the newest version (1:35ubuntu6). php-curl is already the newest version (1:7.0+35ubuntu6). php-dev is already the newest version (1:7.0+35ubuntu6). php-gd is already the newest version (1:7.0+35ubuntu6). php-gmp is already the newest version (1:7.0+35ubuntu6). php-mbstring is already the newest version (1:7.0+35ubuntu6).

0 pacotes atualizados, 0 pacotes novos instalados, 0 a serem removidos e 0 não atualizados.

fagnersouza@fagnersouza-note:~/Projetos-Laravel/estoque$ composer installLoading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.

Problem 1 - laravel/framework v5.0.9 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.8 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.7 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.6 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.5 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.4 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.35 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.34 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.33 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.32 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.31 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.3 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.29 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.28 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.27 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.26 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.25 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.24 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.23 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.22 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.21 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.20 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.2 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.19 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.18 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.17 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.16 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.15 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.14 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.13 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.12 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.11 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.10 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.1 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework v5.0.0 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - laravel/framework 5.0.30 requires ext-mcrypt -> the requested PHP extension mcrypt is missing from your system. - Installation request for laravel/framework 5.0.* -> satisfiable by laravel/framework[5.0.30, v5.0.0, v5.0.1, v5.0.10, v5.0.11, v5.0.12, v5.0.13, v5.0.14, v5.0.15, v5.0.16, v5.0.17, v5.0.18, v5.0.19, v5.0.2, v5.0.20, v5.0.21, v5.0.22, v5.0.23, v5.0.24, v5.0.25, v5.0.26, v5.0.27, v5.0.28, v5.0.29, v5.0.3, v5.0.31, v5.0.32, v5.0.33, v5.0.34, v5.0.35, v5.0.4, v5.0.5, v5.0.6, v5.0.7, v5.0.8, v5.0.9].

To enable extensions, verify that they are enabled in those .ini files: - /etc/php/7.0/cli/php.ini - /etc/php/7.0/cli/conf.d/10-opcache.ini - /etc/php/7.0/cli/conf.d/10-pdo.ini - /etc/php/7.0/cli/conf.d/15-xml.ini - /etc/php/7.0/cli/conf.d/20-calendar.ini - /etc/php/7.0/cli/conf.d/20-ctype.ini - /etc/php/7.0/cli/conf.d/20-curl.ini - /etc/php/7.0/cli/conf.d/20-dom.ini - /etc/php/7.0/cli/conf.d/20-exif.ini - /etc/php/7.0/cli/conf.d/20-fileinfo.ini - /etc/php/7.0/cli/conf.d/20-ftp.ini - /etc/php/7.0/cli/conf.d/20-gd.ini - /etc/php/7.0/cli/conf.d/20-gettext.ini - /etc/php/7.0/cli/conf.d/20-gmp.ini - /etc/php/7.0/cli/conf.d/20-iconv.ini - /etc/php/7.0/cli/conf.d/20-json.ini - /etc/php/7.0/cli/conf.d/20-mbstring.ini - /etc/php/7.0/cli/conf.d/20-phar.ini - /etc/php/7.0/cli/conf.d/20-posix.ini - /etc/php/7.0/cli/conf.d/20-readline.ini - /etc/php/7.0/cli/conf.d/20-shmop.ini - /etc/php/7.0/cli/conf.d/20-simplexml.ini - /etc/php/7.0/cli/conf.d/20-sockets.ini - /etc/php/7.0/cli/conf.d/20-sysvmsg.ini - /etc/php/7.0/cli/conf.d/20-sysvsem.ini - /etc/php/7.0/cli/conf.d/20-sysvshm.ini - /etc/php/7.0/cli/conf.d/20-tokenizer.ini - /etc/php/7.0/cli/conf.d/20-wddx.ini - /etc/php/7.0/cli/conf.d/20-xmlreader.ini - /etc/php/7.0/cli/conf.d/20-xmlwriter.ini - /etc/php/7.0/cli/conf.d/20-xsl.ini

You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

fagnersouza@fagnersouza-note:~/Projetos-Laravel/estoque$ php artisan serve PHP Warning: require(/home/fagnersouza/Projetos-Laravel/estoque/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/fagnersouza/Projetos-Laravel/estoque/bootstrap/autoload.php on line 17 PHP Fatal error: require(): Failed opening required '/home/fagnersouza/Projetos-Laravel/estoque/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php') in /home/fagnersouza/Projetos-Laravel/estoque/bootstrap/autoload.php on line 17


Alguma sugestão?

Ainda faltava instalar uma extensão no php. Resolvi instalando:


sudo apt-get install mcrypt php-mcrypt