error when I try to open app_dev.php file - symfony

I install symfony 2 under htdocs(xampp) folder, I start apache then I try to open app_dev.php file using this url :
http://localhost/symfony2/web/app_dev.php
I get this error :
Warning: require(C:\xampp\htdocs\symfony2\app/../vendor/autoload.php):
failed to open stream: No such file or directory in
C:\xampp\htdocs\symfony2\app\autoload.php on line 9
Fatal error: require(): Failed opening required
'C:\xampp\htdocs\symfony2\app/../vendor/autoload.php'
(include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\symfony2\app\autoload.php on line 9
the tutorial that I follow (here) say that it will open a page

I reistall symfony using this command :
$ composer create-project symfony/framework-standard-edition my_project_name "2.7.*"
it works perfectly

Best way is to start symfony via the console to get the development enviroment:
bin/console server:run
http://symfony.com/doc/current/book/installation.html#running-the-symfony-application
Also check the read and write privileges, and check the composer installation.

Related

Problem with yarn dependency using the rhino R package

I am trying the new R package rhino from the Appsilon team to build shiny apps.
Running on a Windows10 laptop I installed the dependencies node.js and yarn as described in this tutorial.
Here is the output of rhino::diagnostics() :
Windows 10 x64 build 19042
R version 4.1.0 (2021-05-18)
rhino: 1.0.0
node: v16.15.0
yarn: 1.22.15
Running rhino::build_sass() gives me this error:
yarn run v1.22.15
$ sass --no-source-map --style=compressed root/app/styles/main.scss:root/app/static/css/app.min.css
Error reading root\app\styles\main.scss: no such file or directory.
error Command failed with exit code 66.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error:
! System command 'yarn' exited with status 66.
i If you can't use Node.js and yarn, try using sass: 'r' configuration.
Run `rlang::last_error()` to see where the error occurred.
I am puzzled by the paths in the call to "sass" that start with "root/app". My app is located in my home directory:
"C:/Users/XXX/Documents/workspace/rhino_dummy"
Is it possible that these paths are wrong in the call?
Luckily, the suggested alternative with the deprecated libsass interpreter works for the sass example in the tutorial. It would be nice to have node.js with sass working on Windows10 for future more complex apps.
Edit 1, after Kat's comment
Thanks Kat for the quick feedback. I added sass via yarn add sass and tried again same error:
> rhino::build_sass()
yarn run v1.22.15
warning ..\..\package.json: No license field
$ sass --no-source-map --style=compressed root/app/styles/main.scss:root/app/static/css/app.min.css
Error reading root\app\styles\main.scss: no such file or directory.
error Command failed with exit code 66.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error:
! System command 'yarn' exited with status 66.
i If you can't use Node.js and yarn, try using sass: 'r' configuration.
Run `rlang::last_error()` to see where the error occurred.
The warning is coming from the pckage.json file that was created by calling yarn inside my R project folder. It has only minimal content:
# package.json
{
"dependencies": {
"sass": "^1.51.0"
}
}
Out of curiosity, I tried to compile the javascript example, also failed with very similar error regarding folder paths:
> rhino::build_js()
yarn run v1.22.15
warning ..\..\package.json: No license field
$ webpack
assets by status 0 bytes [cached] 1 asset
ERROR in main
Module not found: Error: Can't resolve 'C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node\root\app\js\index.js' in 'C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node'
resolve 'C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node\root\app\js\index.js' in 'C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node'
using description file: C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node\package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration using description file: C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node\package.json (relative path: ./root/app/js/index.js)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node\root\app\js\index.js doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node\root\app\js\index.js.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node\root\app\js\index.js.json doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node\root\app\js\index.js.wasm doesn't exist
as directory
C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node\root\app\js\index.js doesn't exist
webpack 5.69.0 compiled with 1 error in 162 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error in `system_yarn()`:
! System command 'yarn' exited with status 1.
Run `rlang::last_error()` to see where the error occurred.
For Node.js functions to work on Windows 10, you'll need to enable Developer Mode on your system as mentioned in our How-to: Use Rhino on Windows article. This is necessary for symbolic links to work on Windows (and the .rhino/node/root file is a symbolic link to the root of the project).
After you do that, delete the .rhino/node directory from your project, or run rhino:::add_node(clean = TRUE) in the root of your project.
Workaround
This answer is only a workaround, if you cannot enable developer mode on windows (see Kamil Zyla's post for more information).
It looks like the folder name "root" in the error messages is a broken variable.
The folder ...\workspace\rhino_dummy\.rhino\node\root does not exist, but the substructures do exit:
app\styles\main.scss
app\js\index.js
...\workspace\rhino_dummy\.rhino\node
Fix step1
I tried my luck and created the folder "root": C:\Users\XXX\Documents\workspace\rhino_dummy\.rhino\node\root
copied rhino_dummy\app\styles\main.scss to rhino_dummy\.rhino\node\root\app\styles\main.scss
copied rhino_dummy\app\js\index.js to rhino_dummy\.rhino\node\root\app\js\index.js
running rhino::build_sass() and rhino::build_js() now worked!
rhino::build_sass()
yarn run v1.22.15
warning ..\..\package.json: No license field
$ sass --no-source-map --style=compressed root/app/styles/main.scss:root/app/static/css/app.min.css
Done in 0.45s.
rhino::build_js()
yarn run v1.22.15
warning ..\..\package.json: No license field
$ webpack
asset app.min.js 470 bytes [compared for emit] [minimized] (name: main)
runtime modules 670 bytes 3 modules
./root/app/js/index.js 113 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 846 ms
Done in 2.58s.
Fix step2
copy results back to "static" folder, where they are expected by shiny/rhino
copy rhino_dummy\.rhino\node\root\app\static\css\app.min.css to rhino_dummy\app\static\css\app.min.css
copy \rhino_dummy\.rhino\node\root\app\static\js\app.min.js to \rhino_dummy\app\static\js\app.min.js
launch the app via shiny::shinyAppDir(".")
click the button from the tutorial ;-)
Edit1
Checking the github repo of rhino
SASS
definition of build_sass()
calling yarn("build-sass")
definition of build-sass
showing hard-coded root/app/styles/main.scss
JS
definition of build_js()
calling yarn("build-js")
definition of "webpack" build-js also showing hard-coded "root" in file paths

Symfony 4 - php bin/console server:run not works

I have a problem with this command : php bin/console server:run on Symfony 4
When I go to http://127.0.0.1:8000/ I have this error message :
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'J:\my_project\vendor\symfony\web-server-bundle/Resources/router.php' (include_path='.;C:\php\pear') in Unknown on line 0
Indeed, the router.php file does not exist !
But if I run this command : php -S 127.0.0.1:8000 -t public everything is ok.
Any idea ?
First check that you have installed the SF4 Web Server bundle :
> composer require server --dev
then you can start using it through Symfony using run / start command
Not sure if this is the case for you too, but it is probably worth checking (and may also be interesting for others having the same problem).
My antivirus software likes to put the router.php in quarantine (effectively removing it from that directory). Check if yours did the same and if so restore it and create an exception for that file. Additionally you should configure your antivirus to notify you if it puts something in quarantine, so you can intervene in time.

app/bootstrap.php.cache : failed to open stream: No such file or directory

After clone project from github i got next error:
Warning: require_once(C:\OpenServer\domains\MyBlog.test\web/../app/bootstrap.php.cache): failed to open stream: No such file or directory in C:\OpenServer\domains\MyBlog.test\web\app_dev.php on line 20
Fatal error: require_once(): Failed opening required 'C:\OpenServer\domains\MyBlog.test\web/../app/bootstrap.php.cache' (include_path='.;c:/openserver/modules/php/PHP-5.5;c:/openserver/modules/php/PHP-5.5/PEAR/pear') in C:\OpenServer\domains\MyBlog.test\web\app_dev.php on line 20
Unfortunately in .gitignore file i founded next note:
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
So, how to solve this problem?.
I execute php composer.phar update command, but it's not helped.
You probably need to run composer to generate the bootstrap file and download vendors.
In your composer.json you will see a build bootstrap command that gets executed for you.
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap"
],

Symfony2 Bootstrap.php.cache

I'm developing in Ubuntu 14 and I get the following error when creating a databaes:
$ php app/console doctrine:database:create
This is the error output:
PHP Warning: require_once(/home/jesse/playground/www/symfony/htdocs/app/bootstrap.php.cache):
failed to open stream: No such file or directory in
/home/jesse/playground/www/symfony/htdocs/app/console on line 10
PHP Fatal error: require_once(): Failed opening required
'/home/jesse/playground/www/symfony/htdocs/app/bootstrap.php.cache'
(include_path='.:/usr/share/php:/usr/share/pear') in
/home/jesse/playground/www/symfony/htdocs/app/console on line 10
What Ive Tried
Running this in Vagrant
Running this Locally
This is one among several problem running Symfony2 under Ubuntu, the other forcing you to implement umask(0000) otherwise you have to get chmod +a permissions for log and cache folders, this seems like a bit of a hassle for something seemingly simple.
Does anyone know what to work around this error?
This should do the trick:
php /home/jesse/playground/www/symfony/htdocs/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

stange error with Behat and Mink on Sf2

I'm using Behat,mink in my Symfony2 project,so I follow those tutorials to make installation :
http://extensions.behat.org/symfony2/ , http://extensions.behat.org/symfony2/migrating_from_2.3_to_2.4.html
but when I run this command php behat.phar --init "#YouBundleName",I get this very strange error :
PHP Warning: require(Behat\MinkExtension\Extension): failed to open stream: No such file or directory in phar:///var/www/project/behat.phar/src/Behat/Behat /Extension/ExtensionManager.php on line 112
PHP Fatal error: require(): Failed opening required 'Behat\MinkExtension\Extension' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///var/www/project/behat.phar/src/Behat/Behat/Extension/ExtensionManager.php on line 112
I'm sure I installed the last version of behat and mink mentionned in the second link above and then I made php composer.phar unpdate and cache clear too,but still the same error?
I had the same problem. Forgot you need to install behat/mink-extension as well as behat/mink. For example you might need to run:
php composer.phar require behat/mink-extension:*
Worked for me.
By the way, looks like you got confused by the two installation methods, phar vs composer. I'd go with the composer route because it's easier to update and manage versions. This would mean running php bin/behat ... instead of php behat.phar ....

Resources