Troubleshooting "require_once(../bootstrap.php.cache): failed to open stream: No such file or directory" - symfony-2.1

I am trying to redeploy a Symfony 2.1x project I have been working on and app_dev.php is failing because it can't find app/bootstrap.php.cache. This file is omitted from the project's git repository because I used Symfony2's recommend .gitignore file:
# .gitignore
/app/bootstrap*
Am I correct in thinking that app/bootstrap.php.cache is generated during the $ php composer.phar install process? If this is the case then I will include for you my composer.json:
// composer.json
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": "2.2.*",
"doctrine/doctrine-bundle": "dev-master",
"twig/extensions": "dev-master",
"symfony/assetic-bundle": "dev-master",
"symfony/swiftmailer-bundle": "dev-master",
"symfony/monolog-bundle": "dev-master",
"sensio/distribution-bundle": "dev-master",
"sensio/framework-extra-bundle": "dev-master",
"sensio/generator-bundle": "dev-master",
"jms/security-extra-bundle": "1.1.*",
"jms/di-extra-bundle": "1.0.*",
"ddeboer/guzzle-bundle": "dev-master",
"mopa/bootstrap-bundle": "dev-master",
"twitter/bootstrap": "master",
"knplabs/knp-paginator-bundle": "dev-master",
"knplabs/knp-menu-bundle": "dev-master",
"craue/formflow-bundle": "dev-master"
},
"repositories": [
{
"type": "package",
"package": {
"version": "master",
"name": "twitter/bootstrap",
"source": {
"url": "https://github.com/twitter/bootstrap.git",
"type": "git",
"reference": "master"
},
"dist": {
"url": "https://github.com/twitter/bootstrap/zipball/master",
"type": "zip"
}
}
}
],
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-install-cmd": [
"Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
],
"post-update-cmd": [
"Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "dev",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
}
}
How can I generate bootstrap.php.cache?

Just go to your project and generate it with composer like
php /path/to/composer/composer.phar install

Just run the following command.
php composer.phar install
Source: http://symfony.com/doc/master/book/performance.html#use-bootstrap-files

You have duplicated post-install-cmd and post-updated-cmd while you should have added MopaBootstrapBundle scripts to existing keys. Try the following composer.json and re-run php composer.phar install
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": "2.2.*",
"doctrine/doctrine-bundle": "dev-master",
"twig/extensions": "dev-master",
"symfony/assetic-bundle": "dev-master",
"symfony/swiftmailer-bundle": "dev-master",
"symfony/monolog-bundle": "dev-master",
"sensio/distribution-bundle": "dev-master",
"sensio/framework-extra-bundle": "dev-master",
"sensio/generator-bundle": "dev-master",
"jms/security-extra-bundle": "1.1.*",
"jms/di-extra-bundle": "1.0.*",
"ddeboer/guzzle-bundle": "dev-master",
"mopa/bootstrap-bundle": "dev-master",
"twitter/bootstrap": "master",
"knplabs/knp-paginator-bundle": "dev-master",
"knplabs/knp-menu-bundle": "dev-master",
"craue/formflow-bundle": "dev-master"
},
"repositories": [
{
"type": "package",
"package": {
"version": "master",
"name": "twitter/bootstrap",
"source": {
"url": "https://github.com/twitter/bootstrap.git",
"type": "git",
"reference": "master"
},
"dist": {
"url": "https://github.com/twitter/bootstrap/zipball/master",
"type": "zip"
}
}
}
],
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "dev",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
}
}

In my case, my composer version was 2.x and the required version was 1.x
so, first i needed to downgrade to version 1 and then i run composer install
sudo composer self-update --1 && composer install -v --prefer-dist

Related

Error importing a user js file using electron-builder

I have an electron application with main process as follows:
const {app, BrowserWindow, Menu, dialog} = require('electron');
const path = require('path')
let logConfig = require('./js/loggConfig.js');
....
This executes perfectly when run directly from terminal.
But when I package this project using electron-builder, and install it on another machine (Windows 10), I get the following error while launching the app:
Error: Cannot find module '.js/loggConfig.js'
How do I resolve this?
Here is how my package.json looks like:
{
"name": "ABCD",
"version": "0.0.1",
"description": "...",
"author": "abcd <abcd#gmail.com>",
"homepage": "http://www.abcd.com",
"main": "main_electron.js",
"scripts": {
"postinstall": "install-app-deps",
"start": "electron .",
"dist": "build"
},
"build": {
"appId": "yourappid",
"dmg": {
"contents": [
{
"x": 110,
"y": 150
},
{
"x": 240,
"y": 150,
"type": "link",
"path": "/Applications"
}
]
},
"linux": {
"target": [
"AppImage",
"deb"
],
"category": "Video"
},
"win": {
"target": "NSIS",
"icon": "build/icon.ico",
"extraResources": [
]
}
},
"dependencies": {
"electron-context-menu": "^0.9.1",
"electron-log": "^2.2.13",
"fs": "0.0.1-security",
"mkdirp": "^0.5.1",
"path": "^0.12.7",
"uuid": "^3.1.0",
"xmlbuilder": "^9.0.4",
"zip-folder": "^1.0.0"
},
"devDependencies": {
"electron": "^1.7.9",
"electron-builder": "^19.49.0"
}
}
I solved the issue changing the build configuration.
Setting asar to false.
Setting asarUnpack to export all the asar content with "**/*".
"build": {
"appId": "app.node.electron",
"productName": "app electron",
"asar":false,
"asarUnpack":[
"**/*"
],
"directories": {
"output": "release"
},
"win": {
"publisherName": "app electron",
"icon": "icon.png",
"target": [
"nsis"
]
},
},

Run more than one task with default shortcut

In a project i use typescript to generate es6 for server side (node.js) and es5 for client side.
I've got a tsconfig.json and a tsconfigclient.json.
I've got two task in tasks.json to generate javascript :
{
"version": "2.0.0",
"tasks": [
{
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "typescript",
"tsconfig": "tsconfigclient.json",
"problemMatcher": [
"$tsc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Both could be run whith ctrl-shift-B ... but vscode ask me witch one to use ?
Is it possible to launch both in same time with ctrl-shift-b
Thanks.
PS : I'm begginer in node.js, typescript and vscode.
One option is to create a composite task that uses dependsOn to run the other two tasks:
{
"version": "2.0.0",
"tasks": [
{
"label": "build1",
"identifier": "build1",
"type": "typescript",
"tsconfig": "tsconfig.json",
"problemMatcher": [
"$tsc"
],
"group": "build"
},
{
"label": "build2",
"identifier": "build2",
"type": "typescript",
"tsconfig": "tsconfigclient.json",
"problemMatcher": [
"$tsc"
],
"group": "build"
},
{
"label": "Composite",
"dependsOn": [
"build1",
"build2"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
You can also use a command line task to run more than one command. This answer has more info about that

DocumentDB Emulator .Net Core Quickstart Not Loading

I'm following steps here to work with the Azure DocumentDB emulator: https://learn.microsoft.com/en-us/azure/cosmos-db/local-emulator
I have the emulator up and running:
I have downloaded the sample .Net Core app. When I attempt to load it I get the following error:
I'm running:
My project file looks like this:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.Azure.DocumentDB.Core": "*"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Anyone else have this problem or know how to fix it?
The quickstart sample is xproj project.json so after conversion to csproj/MSBuild it is necessary to modify the csproj file etc. as outlined here:
https://learn.microsoft.com/en-us/dotnet/core/migration/

Unable to resolve 'Microsoft.WindowsAzure.Storage (>= 7.2.0)' for '.NETCoreApp,Version=v1.0'

I try to use Windows Azure Storage inside my dotnet core system (my first dotnet core project). I tried the unit test for Azure Storage with dotnet core and it builds well.
But when I try to include the dependency to Azure Storage in my project.json, I receive this message:
Unable to resolve 'Microsoft.WindowsAzure.Storage (>= 7.2.0)' for '.NETCoreApp,Version=v1.0'.
Here is my full project.json file
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.*",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.*",
"Microsoft.AspNetCore.Server.IISIntegration":"1.0.*",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.*",
"Microsoft.AspNetCore.Diagnostics": "1.0.*",
"Microsoft.Extensions.Configuration.EnvironmentVariables":"1.0.*",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.*",
"Microsoft.Extensions.Configuration.Json": "1.0.*",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging":"1.0.*",
"Microsoft.Extensions.Logging.Console": "1.0.*",
"Microsoft.Extensions.Logging.Debug": "1.0.*",
"Microsoft.EntityFrameworkCore": "1.0.*",
"Microsoft.EntityFrameworkCore.Sqlite": "1.0.*",
"Microsoft.EntityFrameworkCore.Design": { "version": "1.0.0-preview2-final", "type": "build" },
"Autofac": "4.0.0-rc3-309",
"Autofac.Extensions.DependencyInjection": "4.0.0-rc3-309",
"FluentValidation": "6.4.0-beta3",
// "Serilog" : "2.0.0",
// "Serilog.Extensions.Logging" : "1.0.0",
// "Serilog.Sinks.Console" : "2.0.0"
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": { "version": "1.0.0-preview2-final", "type": "build" },
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.WindowsAzure.Storage": "7.2.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"BundlerMinifier.Core": "2.0.238",
"Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
},
"imports": [
// "dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"define": [ "NETCORE"],
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"precompile": [ "dotnet bundle" ],
"prepublish": [ "bower install" ],
"postpublish": [
"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
]
},
"tooling": {
"defaultNamespace": "Wod6000"
}
}
Do you have an idea on what is wrong?
Our package is named WindowsAzure.Storage. Can you try that instead?

Which MongoDBBundle version works with Symfony 2.1.6?

I am trying to install MongoDBBundle in symfony 2.1.6 using through this link
http://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/index.html
in tutorial they explained to add the following to composer.json
{
"require": {
"doctrine/mongodb-odm-bundle": "3.0.*"
},
"minimum-stability": "dev"
}
this is my composer.json
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
"twig/extensions": "1.0.*#dev",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"kriswallsmith/assetic": "1.1.*#dev"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
}
}
In this where I need to put the line to update composer.json
This should work, running smoothly on 2.1.4 and should work the same with yours in 2.1.6
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
"twig/extensions": "1.0.*#dev",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"kriswallsmith/assetic": "1.1.*#dev",
"doctrine/mongodb-odm-bundle": "3.0.*"
},
"minimum-stability": "dev",
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
}
}

Resources