laravel/lumen-framework:"5.7.*" and flipbox/lumen-generator:"^5.6" Class Not Found - lumen

I think this is related to composer autoload not detecting packages outside laravel/lumen-framework/src
Is my above assumption to the below problem correct? Shall I include psr-4 key inside "autoload-dev" nested object?
I really appreciate your help.
Thanks.
Below is Error Exception, composer.json snippet and Stack Trace Logs
Below composer.json
{
...
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
...
}
Below is the stack trace log found under storage/lumen.log
[2018-10-09 07:51:53] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError:
Class '\FlipBox\LumenGenerator\LumenGeneratorServiceProvider' not found in
/var/www/vendor/laravel/lumen-framework/src/Application.php:183
Stack trace:
#0 /var/www/bootstrap/app.php(86): Laravel\Lumen\Application->register('\\FlipBox\\LumenG...')
#1 /var/www/public/index.php(14): require('/var/www/bootst...')
#2 {main} {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0):
Class '\\FlipBox\\LumenGenerator\\LumenGeneratorServiceProvider' not
found at /var/www/vendor/laravel/lumen-framework/src/Application.php:183)
[stacktrace]
#0 /var/www/bootstrap/app.php(86): Laravel\\Lumen\\Application->register('\\\\FlipBox\\\\LumenG...')
#1 /var/www/public/index.php(14): require('/var/www/bootst...')
#2 {main}
"}

It was really a stupid mistake, after debugging and going to the north pole back and forth. I figured out that I had the class namespace referenced wrongly so instead of using below:
if ($app->environment() !== 'production') {
$app->register(FlipBox\LumenGenerator\LumenGeneratorServiceProvider::class);
}
I should have used small letter b instead of B so the below works:
if ($app->environment() !== 'production') {
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
}
Then doing php artisan list you will get all the make:* goodies:

What really worked for me, was to run composer install or composer update, that installed dependencies that I had not yet installed (due to changes made by others by the use of GIT repository).

Related

Jest: Cannot use import statement outside a module

I got an error when I run test using Jest, I tried to fix this error for 2 hours. But, I couldn't fix it. My module is using gapi-script package and error is occurred in this package. However, I don't know why this is occurred and how to fix it.
jest.config.js
module.exports = {
"collectCoverage": true,
"rootDir": "./",
"testRegex": "__tests__/.+\\.test\\.js",
"transform": {
'^.+\\.js?$': "babel-jest"
},
"moduleFileExtensions": ["js"],
"moduleDirectories": [
"node_modules",
"lib"
]
}
babel.config.js
module.exports = {
presets: [
'#babel/preset-env',
]
};
methods.test.js
import methods, { typeToActions } from '../lib/methods';
methods.js
import { gapi } from "gapi-script";
...
Error Message
C:\haram\github\react-youtube-data-api\node_modules\gapi-script\index.js:1
({"Object.":function(module,exports,require,__dirname,__filename,global,jest){import
{ gapi, gapiComplete } from './gapiScript';
SyntaxError: Cannot use import statement outside a module
What is wrong with my setting?
As of this writing, Jest is in the process of providing support for ES6 modules. You can track the progress here:
https://jestjs.io/docs/en/ecmascript-modules
For now, you can eliminate this error by running this command:
node --experimental-vm-modules node_modules/.bin/jest
instead of simply:
jest
Be sure to check the link before using this solution.
I solved this with the help of Paulo Coghi's answer to another question -
Does Jest support ES6 import/export?
Step 1:
Add your test environment to .babelrc in the root of your project:
{
"env": {
"test": {
"plugins": ["#babel/plugin-transform-modules-commonjs"]
}
}
}
Step 2:
Install the ECMAScript 6 transform plugin:
npm install --save-dev #babel/plugin-transform-modules-commonjs
Jest needs babel to work with modules.
For the testing alone, you do not need jest.config.js, just name the testfiles xxx.spec.js or xxx.test.js or put the files in a folder named test.
I use this babel.config.js:
module.exports = function (api) {
api.cache(true)
const presets = [
"#babel/preset-env"
]
return {
presets
}
}
Adding "type": "module" in package.json or using mjs as stated in other answers is not necessary when your setup is not too complicated.
I have also faced the same issue and this was resolved by adding following command-line option as a environment variable.
export NODE_OPTIONS=--experimental-vm-modules npx jest //linux
setx NODE_OPTIONS "--experimental-vm-modules npx jest" //windows
Upgrading Jest (package.json) to version 29 (latest as of now) solved this problem for me.

TYPO3 CMS 8.7.27: Call to a member function getPackagePath() on null

After installing extensions in typo3 CMS 8.7.27, I got following error.. Seems like the ExtensionManagementUtility can't load the ah_contentapi.
This is my composer.json file in root (/var/www/html/typo3) for loading my extensions:
{
"repositories":[
{
"type":"composer",
"url":"https://composer.typo3.org/"
},
{
"type":"package",
"package":{
"name":"Bm/ah-content-api",
"version":"0.0.1",
"type":"typo3-cms-extension",
"source":{
"url":"https://user#bitbucket.org/company/ah_config_typo3.git",
"type":"git",
"reference":"master"
}
}
},
{
"type":"package",
"package":{
"name":"Bm/ah-contentelements",
"version":"0.0.1",
"type":"typo3-cms-extension",
"source":{
"url":"https://user#bitbucket.org/company/ah_contentelements_typo3.git",
"type":"git",
"reference":"master"
}
}
}
],
"name":"typo3/cms-base-distribution",
"description":"TYPO3 CMS Base Distribution",
"license":"GPL-2.0-or-later",
"require":{
"helhum/typo3-console":"^4.9.3 || ^5.2",
"typo3/cms-about":"^8.7.10",
"typo3/cms-belog":"^8.7.10",
"typo3/cms-beuser":"^8.7.10",
"typo3/cms-context-help":"^8.7.10",
"typo3/cms-documentation":"^8.7.10",
"typo3/cms-felogin":"^8.7.10",
"typo3/cms-fluid-styled-content":"^8.7.10",
"typo3/cms-form":"^8.7.10",
"typo3/cms-func":"^8.7.10",
"typo3/cms-impexp":"^8.7.10",
"typo3/cms-info":"^8.7.10",
"typo3/cms-info-pagetsconfig":"^8.7.10",
"typo3/cms-rte-ckeditor":"^8.7.10",
"typo3/cms-setup":"^8.7.10",
"typo3/cms-sys-note":"^8.7.10",
"typo3/cms-t3editor":"^8.7.10",
"typo3/cms-tstemplate":"^8.7.10",
"typo3/cms-viewpage":"^8.7.10",
"typo3/cms-wizard-crpages":"^8.7.10",
"typo3/cms-wizard-sortpages":"^8.7.10",
"typo3/cms":"^8.7",
"dmitryd/typo3-realurl":"2.*",
"GridElementsTeam/Gridelements":"8.2.*",
"clickstorm/cs_seo":"3.*",
"Bm/ah-content-api":"0.0.1",
"Bm/ah-contentelements":"0.0.1"
},
"scripts":{
"typo3-cms-scripts":[
"typo3cms install:fixfolderstructure",
"typo3cms install:generatepackagestates"
],
"post-autoload-dump":[
"#typo3-cms-scripts"
]
},
"extra":{
"typo3/cms":{
"web-dir":"public"
},
"helhum/typo3-console":{
"comment":"This option is not needed ay more for helhum/typo3-console 5.x",
"install-extension-dummy":false
}
},
"autoload":{
"psr-4":{
"Bm\\AhContentelements\\":"public/typo3conf/ext/ah_contentelements/Classes",
"Bm\\AhContentapi\\":"public/typo3conf/ext/ah_content_api/Classes"
}
}
}
I already cleared cache in install tool at:
1. -> important actions -> clear all cache
2. -> clean up -> Clean typo3temp/ folder
piece from composer.lock:
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is #generated automatically"
],
"content-hash": "954afd2318d54ec9b1dd0e4d7f9b445b",
"packages": [
{
"name": "Bm/ah-content-api",
"version": "0.0.1",
"source": {
"type": "git",
"url": "https://stevenhippovibe#bitbucket.org/hippovibe/ah_config_typo3.git",
"reference": "master"
},
"type": "typo3-cms-extension"
},
{
"name": "Bm/ah-contentelements",
"version": "0.0.1",
"source": {
"type": "git",
"url": "https://stevenhippovibe#bitbucket.org/stevenhippovibe/ah_contentelements_typo3.git",
"reference": "master"
},
"type": "typo3-cms-extension"
},
The Error occurs when the extension folder name under typo3conf/ext/<folder_name> doesn't match extension key used in some places of the system (e.g. using EXT:your_extension_key/... syntax in TypoScript).
Changing folder name fixed similar problem for me.
Check the PHP version and try to change it from i.e. 7.4 to 7.3.
I once had this problem with an extension that should be compatible with PHP 7.4, but wasn't in real life. This solved the problem for me.
Question here is:
How did you update to 8.7.27 (which composer command was executed)
How does your composer.lock look like?
Do you use TYPO3 console or any other special composer plugins / CLI commands to e.g. generate PackageStates.php?
I just ran into the same error message under TYPO3 9.5.5.
Solution:
Deinstall one TYPO3 extension after the other and try it out again. This will lead you to the extension which has an error. Most probably the error is inside of the file ext_localconf.php or ext_tables.php .
I got this error detail:
PHP Warning: Use of undefined constant FH_DEBUG_EXT - assumed 'FH_DEBUG_EXT' (this will throw an Error in a future version of PHP) in /var/www/html/global-extensions/ext/div2007/ext_localconf.php line 15
This has nothing to do with your error. But it can be that you have an error in one of your installed extensions or even in a backup of an extension, e.g. a folder named as extensionname.bak .
Also these recommendations can help:
https://wiki.typo3.org/Exception/CMS/1476107295

StreamEnabled table property causes Serverless failure

I'm using Serverless to deploy my AWS cloudformation stack. On one of my tables, I enable streams via "StreamEnabled": true. When this is enabled, I get an error on deployment: Encountered unsupported property StreamEnabled.
If I remove the property, I get a validation exception: ValidationException: Stream StreamEnabled was null.
I found a git issue that was addressed and apparently fixed (here), but after upgrading to v1.3, I'm still getting the same errors on deployment.
Can anyone lend insight as to what the issue may be?
It is enabled by default. You can check it from shell:
aws dynamodbstreams list-streams
{
"Streams": [
{
"TableName": "MyTableName-dev",
"StreamArn": "arn:aws:dynamodb:eu-west-2:0000000000000:table/MyTableName-dev/stream/2018-10-26T15:06:25.995",
"StreamLabel": "2018-10-26T15:06:25.995"
}
]
}
And:
aws dynamodbstreams describe-stream --stream-arn "arn:aws:dynamodb:eu-west-2:00000000000:table/MyTableName-dev/stream/2018-10-26T15:06:25.995"
{
"StreamDescription": {
"StreamLabel": "2018-10-26T15:06:25.995",
"StreamStatus": "ENABLED",
"TableName": "MyTableName-dev",
"Shards": [
{
"ShardId": "shardId-000000000000000-0000000f",
"SequenceNumberRange": {
"StartingSequenceNumber": "00000000000000000000000"
}
}
],
"CreationRequestDateTime": 1540566385.987,
"StreamArn": "arn:aws:dynamodb:eu-west-2:0000000000000000:table/MyTableName-dev/stream/2018-10-26T15:06:25.995",
"KeySchema": [
{
"KeyType": "HASH",
"AttributeName": "application_id"
}
],
"StreamViewType": "KEYS_ONLY"
}
}
It is not a solution, but found that fact I realized that I don't have an issue.

Ionic with ui-router.stateHelper

Is it possiable to use ionic with ui-router.stateHelper
I want to use this for help me working with nested views:
the property children is what I'm looking for.
If its not possible, how can i do something similar, without defining each child state with name: parent.child?
after installing and import im getting the next error:
TypeError: Cannot read property '#' of undefined at updateView (http://localhost:8100/lib/ionic/js/ionic.bundle.js:62199:69)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:62194:9
at invokeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:21830:9)
at nodeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:21330:11)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20721:13)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20725:13)
at compositeLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20725:13)
at publicLinkFn (http://localhost:8100/lib/ionic/js/ionic.bundle.js:20596:30)
at http://localhost:8100/lib/ionic/js/ionic.bundle.js:14815:27
at Scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:29026:28) <ion-nav-view class="view-container" nav-view-transition="ios">
Ok This is working.. I had problem with the indjection.
this is the right way: (im using browserify)
npm install angular-ui-router.statehelper
then in the package.json
under browser:
"angular-ui-router-helper": "./node_modules/angular-ui-router.statehelper/statehelper.min.js"
and under browserify-shim
"browserify-shim": {
"angular": "angular",
"ionic": "ionic",
"angular-ui-router-helper": {
"exports": "angular.module('ui.router.stateHelper')"
}
},
and then in the index.js:
var rootModule = angular.module('AppName', ['ionic',require('angular-ui-router-helper').name]);
Then u can inject the stateHelperProvider to the config method :)

Which DoctrineBundle version works with Symfony 2.0.15?

I've spent days now trying to sort out my deps in Symfony 2.0.15. I can't find a compatible list of bundles and I've been chasing commits around github trying to follow a chain of non-BC changes to get a list of versions that works for me. Eventually I chose to give up and upgraded to composer, only to find that some of the Doctrine core requires Symfony 2.1, yet some of the other Doctrine bundles require Symfony <2.1 and eventually I gave up on that as well.
Can someone with the following Bundles installed please let me know what stable versions they are using from their deps.lock?
[symfony]
git=http://github.com/symfony/symfony.git
version=v2.0.15
[twig]
git=http://github.com/fabpot/Twig.git
version=v1.8.2
[monolog]
git=http://github.com/Seldaek/monolog.git
version=1.0.2
[doctrine-common]
git=http://github.com/doctrine/common.git
version=2.1.4
[doctrine-dbal]
git=http://github.com/doctrine/dbal.git
version=2.1.7
[doctrine]
git=http://github.com/doctrine/doctrine2.git
version=2.1.7
[swiftmailer]
git=http://github.com/swiftmailer/swiftmailer.git
version=v4.1.7
[assetic]
git=http://github.com/kriswallsmith/assetic.git
version=cc2e9adb744df0704a5357adc1cf9287c427420f
[twig-extensions]
git=http://github.com/fabpot/Twig-extensions.git
[metadata]
git=http://github.com/schmittjoh/metadata.git
version=1.0.0
[SensioFrameworkExtraBundle]
git=http://github.com/sensio/SensioFrameworkExtraBundle.git
target=/bundles/Sensio/Bundle/FrameworkExtraBundle
version=origin/2.0
[JMSSecurityExtraBundle]
git=http://github.com/schmittjoh/JMSSecurityExtraBundle.git
target=/bundles/JMS/SecurityExtraBundle
version=origin/1.0.x
[SensioDistributionBundle]
git=http://github.com/sensio/SensioDistributionBundle.git
target=/bundles/Sensio/Bundle/DistributionBundle
version=origin/2.0
[SensioGeneratorBundle]
git=http://github.com/sensio/SensioGeneratorBundle.git
target=/bundles/Sensio/Bundle/GeneratorBundle
version=origin/2.0
[AsseticBundle]
git=http://github.com/symfony/AsseticBundle.git
target=/bundles/Symfony/Bundle/AsseticBundle
version=v1.0.1
[doctrine-mongodb]
git=http://github.com/doctrine/mongodb.git
[doctrine-mongodb-odm]
git=http://github.com/doctrine/mongodb-odm.git
[DoctrineMongoDBBundle]
git=http://github.com/doctrine/DoctrineMongoDBBundle.git
target=/bundles/Symfony/Bundle/DoctrineMongoDBBundle
version=v2.0.1
[DoctrineMigrationsBundle]
git=https://github.com/doctrine/DoctrineMigrationsBundle.git
target=/bundles/Symfony/Bundle/DoctrineMigrationsBundle
version=origin/2.0
[doctrine-migrations]
git=http://github.com/doctrine/migrations.git
[doctrine-fixtures]
git=http://github.com/doctrine/data-fixtures.git
[DoctrineFixturesBundle]
git=https://github.com/doctrine/DoctrineFixturesBundle.git
target=/bundles/Symfony/Bundle/DoctrineFixturesBundle
version=origin/2.0
[DoctrineBundle]
git=http://github.com/doctrine/DoctrineBundle.git
target=/bundles/Doctrine/Bundle/DoctrineBundle
[FOSJsRoutingBundle]
git=http://github.com/FriendsOfSymfony/FOSJsRoutingBundle.git
target=/bundles/FOS/JsRoutingBundle
[GedmoDoctrineExtensions]
git=http://github.com/l3pp4rd/DoctrineExtensions.git
target=/gedmo-doctrine-extensions
[StofDoctrineExtensionsBundle]
git=http://github.com/stof/StofDoctrineExtensionsBundle.git
target=/bundles/Stof/DoctrineExtensionsBundle
With these combinations I get a constant set of errors due to classes not existing or renamed methods, which I then look up in the github repositories and try to fix to a commit/tag which resolves this error, only to get another set of errors because of other classes not existing or renamed methods. I can't go back to the stable state I had a few weeks ago because of the namespace changes to the Doctrine organisation - (#see What happened to Doctrine's Symfony Bundle repos?)
Alternatively I don't mind switching to composer; heres the composer.json that I tried, but doesn't work
{
"require": {
"symfony/symfony" : "v2.0.15",
"symfony/doctrine-bridge": "2.1.x-dev",
"doctrine/common" : "2.1.4",
"doctrine/orm" : "2.1.6",
"symfony/finder" : "v2.0.15",
"symfony/assetic-bundle" : "2.0.x-dev",
"twig/extensions" : "dev-master",
"jms/security-extra-bundle" : "1.0.x",
"sensio/framework-extra-bundle" : "2.0.x-dev",
"sensio/distribution-bundle" : "2.0.x-dev",
"sensio/generator-bundle" : "2.0.x-dev",
"doctrine/doctrine-bundle": "v1.0.0-beta1",
"doctrine/mongodb-odm-bundle": "v2.0.1",
},
"autoload": {
"psr-0": {
"Oh": "src/"
}
}
}
Whenever I try to fix dependencies in the composer.json I seem to get in a cycle of upgrading and degrading the same packages over and over again but always getting the error "Your requirements could not be solved to an installable set of packages.". If someone could provide me with their composer.json setup using Symfony 2.0.15 with the Doctrine,MongoDB,DoctrineFixtures and DoctrineMigrations bundles I'd be most grateful.
Here's part of my working composer configuration:
{
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.0.15",
"doctrine/orm": "2.1.7",
"twig/extensions": "*",
"symfony/assetic-bundle": "2.0.x-dev",
"sensio/generator-bundle": "2.0.*",
"sensio/framework-extra-bundle": "2.0.*",
"jms/security-extra-bundle": "1.0.*",
"stof/doctrine-extensions-bundle": "*",
"doctrine/doctrine-migrations-bundle": "2.0.*"
}
}
I'm not using ODM though.