martinlindhe / laravel-vue-i18n-generator

Generates a vue-i18n compatible include file from your Laravel translations
MIT License
306 stars 207 forks source link

ERROR using php artisan vue-i18n:generate #11

Closed brian2694 closed 7 years ago

brian2694 commented 7 years ago

Argument 1 passed to MartinLindhe\VueInternationalizationGenerator\Generato r::adjustArray() must be of the type array, integer given, called in D:\Pro yectos\Laravel\Production\soyjugador.net.dev\vendor\martinlindhe\laravel-vu e-i18n-generator\src\Generator.php on line 64 and defined

I've run vendor:publish lot times, but does not work

martinlindhe commented 7 years ago

Hello @brian2694 ! Which version of Laravel are you using here? And, which version of laravel-vue-i18n-generator? Assuming you are using composer, have you tried updating your dependencies with "composer update"?

We recently released a minor update to support the new Laravel 5.4

brian2694 commented 7 years ago

Laravel 5.4 laravel-vue-i18n-generator 0.1.10

Yes, I've used "composer update".

And I've used the library succesfully in other Laravel 5.4 project. I don't know what is happening.

Thank you for the reply

martinlindhe commented 7 years ago

Maybe a full back trace (the error output you get) can shine more light on this. Also, how does your composer.json for this project look? And, output from "composer update" ?

brian2694 commented 7 years ago

Error:

php artisan vue-i18n:generate

[ErrorException] Argument 1 passed to MartinLindhe\VueInternationalizationGenerator\Generato r::adjustArray() must be of the type array, integer given, called in D:\Pro yectos\Laravel\Production\soyjugador.net.dev\vendor\martinlindhe\laravel-vu e-i18n-generator\src\Generator.php on line 64 and defined

Composer json

{ "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": ">=5.6.4", "brian2694/laravel-toastr": "^1.0", "dimsav/laravel-translatable": "^6.0", "felixkiss/uniquewith-validator": "^2.0", "intervention/image": "^2.3", "laravel/framework": "5.4.", "laravel/tinker": "~1.0", "laravelcollective/html": "^5.4", "martinlindhe/laravel-vue-i18n-generator": "^0.1.10", "owen-it/laravel-auditing": "^3.1", "santigarcor/laratrust": "^3.0", "stuyam/laravel-phone-validator": "^1.0", "torann/currency": "^1.0", "tymon/jwt-auth": "^0.5.10", "yajra/laravel-datatables-buttons": "1.", "yajra/laravel-datatables-html": "1.", "yajra/laravel-datatables-oracle": "7." }, "require-dev": { "fzaninotto/faker": "~1.4", "mockery/mockery": "0.9.*", "phpunit/phpunit": "~5.0" }, "autoload": { "classmap": [ "database" ], "psr-4": { "App\": "app/" } }, "autoload-dev": { "psr-4": { "Tests\": "tests/" } }, "scripts": { "post-root-package-install": [ "php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "php artisan key:generate" ], "post-install-cmd": [ "Illuminate\Foundation\ComposerScripts::postInstall", "php artisan optimize" ], "post-update-cmd": [ "Illuminate\Foundation\ComposerScripts::postUpdate", "php artisan optimize" ] }, "config": { "preferred-install": "dist", "sort-packages": true } }

Composer update

composer update Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating autoload files

Illuminate\Foundation\ComposerScripts::postUpdate php artisan optimize Generating optimized class loader The compiled services file has been removed.

martinlindhe commented 7 years ago

The laravel/framework line in composer.json looks wierd to me, that's the only thing I noticed

"laravel/framework": "5.4.",

I think you need to specify version in either "^5.4" form, meaning "5.4 to or newer, if less than 6.0", or "5.4.*" meaning "any 5.4.x version". There is even more ways of doing it: https://getcomposer.org/doc/articles/versions.md

Also, you can see the installed composer packages with "composer show". Perhaps composer do understand this syntax.

brian2694 commented 7 years ago

I've changed the composer.json but nothing. The problem continues :(

martinlindhe commented 7 years ago

Did you also do "composer update" after the change? If you can, please post output of "composer show" so I can rule out my idea in https://github.com/martinlindhe/laravel-vue-i18n-generator/issues/11#issuecomment-277877868

brian2694 commented 7 years ago

Yes I did

brian2694/laravel-toastr 1.0.1 toastr.js for laravel 5.4 dimsav/laravel-translatable v6.1 A Laravel package for multilingual models dnoegel/php-xdg-base-dir 0.1 implementation of xdg base directory specification for php doctrine/inflector v1.1.0 Common String Manipulations with regard to casing and singular/plur... doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP without ... erusev/parsedown 1.6.1 Parser for Markdown. felixkiss/uniquewith-validator 2.0.7 Custom Laravel Validator for combined unique indexes fzaninotto/faker v1.6.0 Faker is a PHP library that generates fake data for you. guzzlehttp/psr7 1.3.1 PSR-7 message implementation hamcrest/hamcrest-php v1.2.2 This is the PHP port of Hamcrest Matchers intervention/image 2.3.11 Image handling and manipulation library with support for Laravel in... jakub-onderka/php-console-color 0.1 jakub-onderka/php-console-highlighter v0.3.2 kkszymanowski/traitor 0.2.3 Add a trait use statement to existing PHP class laravel/framework v5.4.9 The Laravel Framework. laravel/tinker v1.0.0 Powerful REPL for the Laravel framework. laravelcollective/html v5.4.1 HTML and Form Builders for the Laravel Framework league/flysystem 1.0.34 Filesystem abstraction: Many filesystems, one API. maatwebsite/excel 2.1.10 An eloquent way of importing and exporting Excel and CSV in Laravel... martinlindhe/laravel-vue-i18n-generator 0.1.10 Generates a vue-i18n compatible include file from your Laravel tran... mockery/mockery 0.9.7 Mockery is a simple yet flexible PHP mock object framework for use ... monolog/monolog 1.22.0 Sends your logs to files, sockets, inboxes, databases and various w... mtdowling/cron-expression v1.2.0 CRON for PHP: Calculate the next or previous run date and determine... myclabs/deep-copy 1.6.0 Create deep copies (clones) of your objects namshi/jose 5.0.2 JSON Object Signing and Encryption library for PHP. nesbot/carbon 1.22.1 A simple API extension for DateTime. nikic/php-parser v3.0.3 A PHP parser written in PHP orchestra/testbench v3.4.4 Laravel Testing Helper for Packages Development owen-it/laravel-auditing 3.1.11 Keep a change history for your models using laravel and lumen paragonie/random_compat v2.0.4 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7 phpdocumentor/reflection-common 1.0 Common reflection classes used by phpdocumentor to reflect the code... phpdocumentor/reflection-docblock 3.1.1 With this component, a library can provide support for annotations ... phpdocumentor/type-resolver 0.2.1 phpoffice/phpexcel 1.8.1 PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents i... phpseclib/phpseclib 0.3.10 PHP Secure Communications Library - Pure-PHP implementations of RSA... phpspec/prophecy v1.6.2 Highly opinionated mocking framework for PHP 5.3+ phpunit/php-code-coverage 4.0.5 Library that provides collection, processing, and rendering functio... phpunit/php-file-iterator 1.4.2 FilterIterator implementation that filters files based on a list of... phpunit/php-text-template 1.2.1 Simple template engine. phpunit/php-timer 1.0.8 Utility class for timing phpunit/php-token-stream 1.4.9 Wrapper around PHP's tokenizer extension. phpunit/phpunit 5.7.11 The PHP Unit Testing framework. phpunit/phpunit-mock-objects 3.4.3 Mock Object library for PHPUnit psr/http-message 1.0.1 Common interface for HTTP messages psr/log 1.0.2 Common interface for logging libraries psy/psysh v0.8.1 An interactive shell for modern PHP. ramsey/uuid 3.5.2 Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 v... santigarcor/laratrust 3.0.12 This package provides a flexible way to add Role-based Permissions ... sebastian/code-unit-reverse-lookup 1.0.0 Looks up which function or method a line of code belongs to sebastian/comparator 1.2.4 Provides the functionality to compare PHP values for equality sebastian/diff 1.4.1 Diff implementation sebastian/environment 2.0.0 Provides functionality to handle HHVM/PHP environments sebastian/exporter 2.0.0 Provides the functionality to export PHP variables for visualization sebastian/global-state 1.1.1 Snapshotting of global state sebastian/object-enumerator 2.0.0 Traverses array structures and object graphs to enumerate all refer... sebastian/recursion-context 2.0.0 Provides functionality to recursively process PHP variables sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on resources sebastian/version 2.0.1 Library that helps with managing the version number of Git-hosted P... stuyam/laravel-phone-validator 1.0.0 A phone validator for Laravel using the free Twilio phone lookup se... swiftmailer/swiftmailer v5.4.5 Swiftmailer, free feature-rich PHP mailer symfony/console v3.2.3 Symfony Console Component symfony/css-selector v3.2.3 Symfony CssSelector Component symfony/debug v3.2.3 Symfony Debug Component symfony/dom-crawler v3.2.3 Symfony DomCrawler Component symfony/event-dispatcher v3.2.3 Symfony EventDispatcher Component symfony/finder v3.2.3 Symfony Finder Component symfony/http-foundation v3.2.3 Symfony HttpFoundation Component symfony/http-kernel v3.2.3 Symfony HttpKernel Component symfony/polyfill-mbstring v1.3.0 Symfony polyfill for the Mbstring extension symfony/process v3.2.3 Symfony Process Component symfony/routing v3.2.3 Symfony Routing Component symfony/translation v3.2.3 Symfony Translation Component symfony/var-dumper v3.2.3 Symfony mechanism for exploring and dumping PHP variables symfony/yaml v3.2.3 Symfony Yaml Component tijsverkoyen/css-to-inline-styles 2.2.0 CssToInlineStyles is a class that enables you to convert HTML-pages... torann/currency 1.0.6 This provides Laravel 5 with currency functions such as currency fo... twilio/sdk 4.12.0 A PHP wrapper for Twilio's API tymon/jwt-auth 0.5.10 JSON Web Token Authentication for Laravel 4 and 5 vlucas/phpdotenv v2.4.0 Loads environment variables from .env to getenv(), $_ENV and ... webmozart/assert 1.2.0 Assertions to validate method input/output with nice error messages. yajra/laravel-datatables-buttons v1.0.0 jQuery DataTables Buttons Plugin for Laravel. yajra/laravel-datatables-html v1.1.0 Laravel DataTables HTML builder plugin for Laravel 5.4+. yajra/laravel-datatables-oracle v7.1.3 jQuery DataTables API for Laravel 4|5

martinlindhe commented 7 years ago

Thanks. I've looked a bit more at the issue and to me it looks like one of the files in your folder that should contain laravel translation files, contains some other data, and the script gets confused. I'll look into making a better error message when this happens.

brian2694 commented 7 years ago

I'm feeling like a fool. I've checked the lang folder and I don't know when, but I copied and pasted a User model there. Thanks a lot for your time and your fast reply. Have a good day. The generator is working perfect.

martinlindhe commented 7 years ago

We've all been there :-) Glad we figured it out. I have made a minor change that should in your case rather error out with a hint of what was going wrong.