Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fl make failed #37

Closed
xchl opened this issue Mar 23, 2023 · 5 comments
Closed

fl make failed #37

xchl opened this issue Mar 23, 2023 · 5 comments

Comments

@xchl
Copy link

xchl commented Mar 23, 2023

php7.4
flarum-li last version

`
root@4a29d7657b5b:/data/www/packages/test# flarum-cli make backend model
✔ Work in Flarum package located at /data/www/packages/test? … yes
✔ Model class name … Test
✔ Table name (Optional) … test
✔ Generate corresponding Migration? … yes
✔ Generate corresponding API Serializer? … yes
✔ Generate corresponding Validator? … yes
✔ Generate corresponding Repository? … yes
✔ Generate corresponding Policy? … yes

Error occurred, and could not complete:
Command failed: php /usr/local/lib/node_modules/@flarum/cli/php-subsystem/index.php
Error: Command failed: php /usr/local/lib/node_modules/@flarum/cli/php-subsystem/index.php
at StepManager.run (/usr/local/lib/node_modules/@flarum/cli/lib/boilersmith/step-manager.js:84:31)
at async Model.run (/usr/local/lib/node_modules/@flarum/cli/lib/base-command.js:57:21)
at async Model._run (/usr/local/lib/node_modules/@flarum/cli/node_modules/@oclif/core/lib/command.js:74:22)
at async Config.runCommand (/usr/local/lib/node_modules/@flarum/cli/node_modules/@oclif/core/lib/config/config.js:268:25)
at async Object.run (/usr/local/lib/node_modules/@flarum/cli/node_modules/@oclif/core/lib/main.js:78:5)
`

@askvortsov1
Copy link
Member

Are you sure you have php installed?

@xchl
Copy link
Author

xchl commented Mar 24, 2023

Yes I'm sure;
this is my php version info
PHP 7.4.28 (cli) (built: Mar 29 2022 03:26:50) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies
with Xdebug v3.1.4, Copyright (c) 2002-2022, by Derick Rethans

@xchl
Copy link
Author

xchl commented Mar 24, 2023

I tried this way but no result, I don't know what's step wrong

php /usr/local/lib/node_modules/@flarum/cli/php-subsystem/index.php {"extend.php":"<?php\n\n/*\n * This file is part of test/test.\n *\n * Copyright (c) 2023 aaa.\n *\n * For the full copyright and license information, please view the LICENSE.md\n * file that was distributed with this source code.\n */\n\nnamespace Test\\\\Test;\n\nuse Flarum\\Extend;\n\nreturn [\n (new Extend\\Frontend('forum'))\n ->js(__DIR__.'/js/dist/forum.js')\n ->css(__DIR__.'/less/forum.less'),\n (new Extend\\Frontend('admin'))\n ->js(__DIR__.'/js/dist/admin.js')\n ->css(__DIR__.'/less/admin.less'),\n new Extend\\Locales(__DIR__.'/locale'),\n];\n","op":"extender.add","params":{"extender":{"className":"\\Flarum\\Extend\\Policy"},"methodCalls":[{"methodName":"modelPolicy","args":[{"type":"class_const","value":"Test\\Test\\Aaa","auxiliaryValue":"class"},{"type":"class_const","value":"Test\\Test\\Access\\AaaPolicy","auxiliaryValue":"class"}]}]}}

@xchl
Copy link
Author

xchl commented Mar 24, 2023

I retried went this error
flarum-cli make backend model boxer
✔ Work in Flarum package located at /Users/x/Documents/codes/php/fl-test? … yes
✔ Model class name … Boxer
✔ Table name (Optional) …
✔ Generate corresponding Migration? … yes
✔ Generate corresponding API Serializer? … yes
✔ Generate corresponding Validator? … yes
✔ Generate corresponding Repository? … yes
✔ Generate corresponding Policy? … no
✔ Generate corresponding Domain Handlers? … yes
✔ Generate corresponding CRUD API Controllers? … yes
✔ Generate corresponding API Routes? … yes
PHP Fatal error: Uncaught PhpParser\Error: Syntax error, unexpected T_NS_SEPARATOR, expecting ';' or '{' on line 12 in /opt/homebrew/lib/node_modules/@flarum/cli/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php:318
Stack trace:
#0 /opt/homebrew/lib/node_modules/@flarum/cli/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php(159): PhpParser\ParserAbstract->doParse()
#1 /opt/homebrew/lib/node_modules/@flarum/cli/php-subsystem/src/ExtenderUtil.php(82): PhpParser\ParserAbstract->parse('<?php\n\n/\n * Th...')
#2 /opt/homebrew/lib/node_modules/@flarum/cli/php-subsystem/src/ExtenderUtil.php(60): Flarum\CliPhpSubsystem\ExtenderUtil->backupOriginal('<?php\n\n/
\n * Th...')
#3 /opt/homebrew/lib/node_modules/@flarum/cli/php-subsystem/src/ExtenderUtil.php(55): Flarum\CliPhpSubsystem\ExtenderUtil->run(Object(Flarum\CliPhpSubsystem\NodeVisitors\AddExtender))
#4 /opt/homebrew/lib/node_modules/@flarum/cli/php-subsystem/index.php(11): Flarum\CliPhpSubsystem\ExtenderUtil->add(Array)
#5 {main}
thrown in /opt/homebrew/lib/node_modules/@flarum/cli/php-subsystem/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php on line 318

@xchl
Copy link
Author

xchl commented Mar 24, 2023

I found the issue the namespace "Test\\Test" is wrong .

/*
 * This file is part of test/test.
 *
 * Copyright (c) 2023 aaa.
 *
 * For the full copyright and license information, please view the LICENSE.md
 * file that was distributed with this source code.
 */

namespace Test\\Test;        //this line is wrong

use Flarum\Extend;

return [
  (new Extend\Frontend('forum'))
    ->js(__DIR__.'/js/dist/forum.js')
    ->css(__DIR__.'/less/forum.less'),
  (new Extend\Frontend('admin'))
    ->js(__DIR__.'/js/dist/admin.js')
    ->css(__DIR__.'/less/admin.less'),
  new Extend\Locales(__DIR__.'/locale'),
];

@xchl xchl closed this as completed Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants