syntax error, unexpected ‘:’, expecting ‘;’ or ‘{’
- muhammadnaveed
- Member | 11
I just installed new nette project using composer but I face the following problem while running my project, please reply in English. Thanks
Source file
File: …\nette\php-generator\src\PhpGenerator\Helpers.php:30
20: use Nette\StaticClass;
21:
22: const PHP_IDENT = ‘[a-zA-Z_\x7f-\xff][a-zA-Z0–9_\x7f-\xff]*’;
23: const MAX_DEPTH = 50;
24: const WRAP_LENGTH = 70;
25:
26:
27: /**
28: * Returns a PHP representation of a variable.
29: */
30: public static function dump($var): string
31: {
32: return self::_dump($var);
33: }
- David Matějka
- Moderator | 6445
how exactly did you install it? it seems you've installed version which targets php 7, but you have older php on your system.
- muhammadnaveed
- Member | 11
David Matějka wrote:
how exactly did you install it? it seems you've installed version which targets php 7, but you have older php on your system.
Thanks David for your reply, oh yeah David I am using php 5.6, I used the following command to install.
composer create-project nette/web-project nette-blog
so how to Install it for the older version?
- David Matějka
- Moderator | 6445
Oh, it is probably an issue with pre-cached vendor in web-project. try to
delete vendor folder and composer.lock file and run
composer update
. Hopefully it will resolve dependencies
correctly.
or maybe try to install older version of web-project, which seem to have correct version of dependencies
composer create-project nette/web-project:1.8.4 nette-blog
- muhammadnaveed
- Member | 11
David Matějka wrote:
Oh, it is probably an issue with pre-cached vendor in web-project. try to delete vendor folder and composer.lock file and run
composer update
. Hopefully it will resolve dependencies correctly.or maybe try to install older version of web-project, which seem to have correct version of dependencies
composer create-project nette/web-project:1.8.4 nette-blog
Thank you so much David, after deleting vendor folder and composer.lock file
and running composer update
it is now working. The problem was the
pre-chached vendor as you pointed out. Thanks for the help
Last edited by muhammadnaveed (2017-04-08 01:02)
- muhammadnaveed
- Member | 11
CZechBoY wrote:
Also if you use php7 on localhsot (which you use to install librabries), but you have php5.6 on production – add this to you composer.json (to main section, next to name, description, require, …)
"config": { "platform": { "php": "5.6.16" } }
Thanks for the nice nice suggestion. :-)