I am trying to insert a composer JSON text into a TEXT column of a MySQL database.
If I insert the following
insert into server_details set composer = '"psr-4": {
"App\\": "app/"
}'
What is inserted into the database is
"psr-4": { "App\": "app/" }
Notice only a single back slash after App. How can I insert the composer JSON into a sql database without making the JSON invalid?
Full JSON being inserted is:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.3",
"barryvdh/laravel-dompdf": "^0.8.7",
"facade/ignition": "^2.10.2",
"fideloper/proxy": "^4.3.0",
"freshbitsweb/laratables": "^2.4",
"guzzlehttp/guzzle": "^7.3.0",
"ignited/laravel-omnipay": "3.3.*",
"intervention/image": "^2.5",
"ivopetkov/html5-dom-document-php": "^2.2.9",
"laravel/framework": "8.*",
"laravel/ui": "^v3.3.0",
"laravelcollective/html": "^v6.2.1",
"league/csv": "^9.7.1",
"milon/barcode": "^8.0",
"omnipay/sagepay": "3.*",
"predis/predis": "^1.1",
"shvetsgroup/laravel-email-database-log": "^8.0",
"spatie/eloquent-sortable": "^3.11.0",
"spatie/laravel-activitylog": "^3.17.0",
"spatie/laravel-newsletter": "^4.10",
"spatie/laravel-permission": "^4.2"
},
"require-dev": {
"laravel/tinker": "^2.6.1",
"barryvdh/laravel-debugbar": "^3.6.2",
"barryvdh/laravel-ide-helper": "^v2.8.2",
"filp/whoops": "^2.13",
"laminas/laminas-code": "^3.4.1",
"laracasts/generators": "^1.1.8",
"mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^7.5.20",
"symfony/yaml": "^4.1"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"dont-discover": [
]
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"#php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
Disabling NO_BACKSLASH_ESCAPES mode disables black slashes.
if
NO_BACKSLASH_ESCAPES mode is enabled, use "App\/";
Based on those tutorials :
https://angular-templates.io/tutorials/about/angular-internationalization-i18n-multi-language-appand https://medium.com/#ismaestro/angular-7-example-app-with-angularcli-angular-universal-i18n-official-firebase-66deac2dc31e
I'm trying to build and use an Angular 8 app using i18n as internationalisation system.
However, when I try to run npm build:ssr (cfr. below), I get An unhandled exception occurred: Project target does not exist.
Here, the angular.json:
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"boilerplate": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"en": {
"outputPath": "dist/browser/",
"baseHref": "/",
"i18nFile": "src/locale/messages.en.xlf",
"i18nFormat": "xlf",
"i18nLocale": "en",
"i18nMissingTranslation": "error",
"assets": [
{
"glob": "**/*",
"input": "src/assets/",
"output": "/assets/",
"ignore": [
"base/*",
"css/*",
"js/*"
]
},
{
"glob": "**/*",
"input": "src/assets/base",
"output": "/"
}
]
},
"fr": {
"outputPath": "dist/browser/",
"baseHref": "/fr/",
"i18nFile": "src/locale/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error",
"assets": [
{
"glob": "**/*",
"input": "src/assets/",
"output": "/assets/",
"ignore": [
"base/*",
"css/*",
"js/*"
]
},
{
"glob": "**/*",
"input": "src/assets/base",
"output": "/"
}
]
},
"production-en": {
"assets": [
{
"glob": "**/*",
"input": "src/assets/",
"output": "/assets/",
"ignore": [
"base/*",
"css/*",
"js/*"
]
},
{
"glob": "**/*",
"input": "src/assets/base",
"output": "/"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
],
"outputPath": "dist/browser/",
"baseHref": "/",
"i18nFile": "src/locale/messages.en.xlf",
"i18nFormat": "xlf",
"i18nLocale": "en",
"i18nMissingTranslation": "error"
},
"production-fr": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
],
"outputPath": "dist/browser/fr/",
"baseHref": "/fr/",
"i18nFile": "src/locale/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error"
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "boilerplate:build:production-en"
},
"configurations": {
"fr": {
"browserTarget": "boilerplate:build:production-fr"
},
"en": {
"browserTarget": "boilerplate:build:production-en"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "boilerplate:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"boilerplate-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "boilerplate:serve"
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "boilerplate",
"schematics": {
"#schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"#schematics/angular:directive": {
"prefix": "app"
}
}
}
and a part of the package.json:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"lint": "ng lint boilerplate",
"build:prod:en": "ng build --configuration=production-en",
"build:prod:fr": "ng build --configuration=production-fr",
"build:server:prod:en": "ng run boilerplate:server:production-en",
"build:server:prod:fr": "ng run boilerplate:server:production-fr",
"build:library": "ng build ngx-example-library",
"build:client-and-server-bundles": "npm run build:prod:en && npm run build:prod:fr && npm run build:server:prod:en && npm run build:server:prod:fr",
"webpack:server": "webpack --config webpack.server.config.js --progress --colors",
"build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server",
"serve:ssr": "node dist/server"
},
As previously explain, I would like to successfully run my Angular application with i18n. But the error message is:
[error] Error: Project target does not exist.
at WorkspaceNodeModulesArchitectHost.getBuilderNameForTarget (/Users/user$
at RunCommand.runSingleTarget (/Users/user/Desktop/Boilerplate/boilerpla$
at RunCommand.runArchitectTarget (/Users/user/Desktop/Boilerplate/boiler$
at RunCommand.run (/Users/user/Desktop/Boilerplate/boilerplate/node_modu$
at RunCommand.validateAndRun (/Users/user/Desktop/Boilerplate/boilerplat$
at process._tickCallback (internal/process/next_tick.js:43:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:778:11)
at startup (internal/bootstrap/node.js:300:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:826:3)
If someone already had the same issue and could explain me what I'm doing wrong ? Thx
I found this. The problem is:
1) you are missing architect config in angular.json file.
2) There is a problem at your browserTarget. The target must point to the project, not to Angular.
1) Please add these line to angular.json file => project => {{your project name}} => achitect: (remember to replace"{{project name}}"` to your project name)
"server": {
"builder": "#angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/"{{project name}}"/server",
"main": "server.ts",
"tsConfig": "tsconfig.server.json"
},
"configurations": {
"production": {
"outputHashing": "media",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"sourceMap": false,
"optimization": true
}
}
},
"serve-ssr": {
"builder": "#nguniversal/builders:ssr-dev-server",
"options": {
"browserTarget": ""{{project name}}":build",
"serverTarget": ""{{project name}}":server"
},
"configurations": {
"production": {
"browserTarget": ""{{project name}}":build:production",
"serverTarget": ""{{project name}}":server:production"
}
}
},
"prerender": {
"builder": "#nguniversal/builders:prerender",
"options": {
"browserTarget": ""{{project name}}":build:production",
"serverTarget": ""{{project name}}":server:production",
"routes": [
"/"
]
},
"configurations": {
"production": {}
}
}
2) Make sure you have #nguniversal/express-engine and #nguniversal/builders in your package.json:
npm i #nguniversal/express-engine #nguniversal/builders -D
I have solved it using below command:
ng add #ionic/cordova-builders
Source: ionic forum
I had the same problem and my fix was to add the "server" information.
because this line
"build:client-and-server-bundles": "ng build --prod && ng run ngkol:server:production",
this is trying to run ng run ngkol:server:production <<<
"projects": {
"ngkol": {
"projectType": "application",
"schematics": {},
"root": "src",
"sourceRoot": "src",
"prefix": "app",
"architect": {
//2019-08-23 here goes your other info
// build, serve,extract-i18n, options, lint, e2e,
"server": {
"builder": "#angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
"production": {
"fileReplacements": [{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}]
}
}
}
here my app running https://www.supercolegas.com/soon
I got this error because my project name was slightly different from the name of my working directory.
Because of this, when I wrote in the 'project name' as this answer advised, I was writing in the name of my project's directory and not the name of the project itself.
The name of the project can be confirmed in the angular.json file in the projects object.
you can try this:
"server": {
"builder": "#angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json" -------- Try to Replace tsconfig.server.json by tsconfig.app.json -------------
},
"configurations": {
"production": {
"fileReplacements": [{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}]
}
}
}
I had issue when i add code "laravelcollective/html": "5.3.*" in composer.json, and then i try to update composer via command line in windows and show this in my command line.
PLEASE HELP ME GUYS, THANKS :))
always show like this, if i try to update composer
This my composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*"
"laravelcollective/html": "5.3.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"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"
}
}
You're missing a comma(,) here "laravel/framework": "5.3.*",
If invalid json error occurred you can check which line creates error by validating your json code here. Just paste your code and it will highlight the line(s) for you.
You may try to change the line where it gives an error to something like this.
"laravelcollective/html": "^5.2",
ANd to make it easier. Add a comma at the end of the
"laravel/framework": "5.3.*"
Hope it could help.
Correct answer :D
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*",
"laravelcollective/html": "^5.2"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"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"
}
}
Finally i can update composer :D
Update your laravel/framework dependency to 5.3.* in your composer.json file.
You should also upgrade your symfony/css-selector and symfony/dom-crawler dependencies to 3.1.* in the require-dev section of your composer.json file.
I think question is almost same but error is different.
I just install laravel 5.2 and trying to install quickadmin packages. But I got this error. I also update composer. I tried this suggestion and also some other suggestions. But It's not working. I also tried older version of composer.json configuration. But unfortunately It's not working.
Error:
Here is my Composer.json configuration without changing anything.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"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"
}
}
Any suggestions how to solve in laravel 5.2?
I recently ran latest composer installation for a Yii2 basic application template.
But running php composer.phar install throws this exception:
Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not
exist
The "yiisoft/yii2-composer" plugin requires composer-plugin-api 1.0.0,
this WIL L break in the future and it should be fixed ASAP (require
^1.0 for example).
[ReflectionException] Class
Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist
[ErrorException]
Declaration of
Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository::w
hatProvides() should be compatible with
Composer\Repository\ComposerRepository::
whatProvides(Composer\DependencyResolver\Pool $pool, $name,
$bypassFilters = fal se)
Here is my composer.json:
{
"name": "yiisoft/yii2-app-basic",
"description": "Yii 2 Basic Project Template",
"keywords": ["yii2", "framework", "basic", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
"config": {
"process-timeout": 1800
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"runtime": "0777",
"web/assets": "0777",
"yii": "0755"
}
],
"generateCookieValidationKey": [
"config/web.php"
]
},
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
}
What could have gone wrong? Anyone experiencing this?
Like the error message says:
The "yiisoft/yii2-composer" plugin requires composer-plugin-api 1.0.0, this WILL break in the future and it should be fixed ASAP (require ^1.0 for example).
Try to update your fxp/composer-asset-plugin:
php composer.phar global update fxp/composer-asset-plugin --no-plugins
PS: If after update it still not working, try also following:
composer global require fxp/composer-asset-plugin --no-plugins