I am currently trying to move my Symfony App from dev to prod. I am running this commandline script to compile my js and css files:
php app/console assetic:dump --watch;
When I do so, I get the following error:
The source file "/Applications/XAMPP/xamppfiles/htdocs/symfonydev/app/../web/assets/js/js/bootstrap/" does not exist.
I have also run this script:
php app/console assetic:dump --env=prod --no-debug
It gives me a whole other bunch of issues which I will put in another post question.
I have run these scripts to see I can find the file that this is happening in:
find . -name '*.html.twig' -exec grep -li 'assets/js/js/bootstrap*' {} \;
find . -name '*.html.twig' -exec grep -li 'js/js/bootstrap*' {} \;
find . -name '*.html.twig' -exec grep -li 'js/bootstrap*' {} \;
They return no values :(
I cannot compile my js files because I keep getting this error. How in the world do I proceed in moving this Symfony2 app! Please assist if you could.
Thanks!
I found the issue, I had some Bundles in Symfony that were incorrectly configured. Then I found a rouge directory that I made waaaaaaay back when and removed it. Once I did that and ran
sudo rm -rf app/cache/* app/logs/*
and then ran
php app/console assetic:dump --env=prod --no-debug
all was well. Thanks for your feedback everyone!
Related
I have a directory that contains multiple files and directories and i wanted to delete all the content and exclude one subdirectory; what i did was:
rm -rf * --exclude='directorytokeep'
it worked halfway throu the rm command but once it reached the directory i wanna keep it didn't go after the other files and directories.
thank you
Please test first with
find . -maxdepth 1 ! -name directorytokeep -exec echo rm -rf {} \;
before removing the echo in the command.
I'd like to execute the command latexmk -c on all of the directories inside a directory, e.g.,
.
./test-dir
The effect is to remove all of the auxiliary files created curing latex compilation.
I've tried using the find command to tell me about the directories and then execute a command, like so:
find -type d -exec latexmk -c \;
But unfortunately, that command only has the effect of removing the auxiliary files in the directory in which I call it, not in the subdirectory (test-dir in this example).
I had a very similar problem: I wanted to convert .tex files recursively. The final solution for me was:
find . -name '*.tex' -execdir latexmk -pdf {} \;
The secret here is to use -execdir instead of -exec which executes the command in the directory the file was found. So the solution to your problem is most likely:
find -type d -execdir latexmk -c \;
when I tried to run the command php bin/console doctrine:generate:entities App:Center in symfony 4.0.6 I get this error:
Can't find base path for "App\Entity\Center" (path:
"/home/USER/foo/bar/src/Entity",
destination: "/home/USER/foo/bar/src/Entity").
the Center is my entity name!
how can I fix this?
Doctrine developers are deprecating the generation commands for Symfony 4. The reason why it doesn't work for you is because the command is hardwired to find the destination directory under
projectRoot/src/{namespace}/{App}Bundle/Entity/{Center.php}
but the Symfony 4 directory structure is different than that, hence it cannot find it. If you are dead-set on using the command, you could probably extend it and create your own, in which you could change the destination path(s) for your entities. You can just skip the command part and generate getters and setters on your own.
Doctrine issue: https://github.com/doctrine/DoctrineBundle/issues/729
Symfony issue: https://github.com/symfony/symfony-docs/issues/8893
From the maintainers of Doctrine:
https://github.com/doctrine/DoctrineBundle/pull/790
So, from the various questions, I think your first problem is files permissions...
Meanwhile, you need to first correct your files permissions.
Here is how to do it.
chown /home/alireza/Projects/www/ www-data:www-data /
find /home/alireza/Projects/www/ -type d -exec chmod 0755 "{}" \;
find /home/alireza/Projects/www/ -type f -exec chmod 0664 "{}" \;
find /home/alireza/Projects/www/ -type d -exec chmod g-s "{}" \;
find /home/alireza/Projects/www/ -type d -exec chmod g+s "{}" \;
As I assume that www/ is where all your projects are stored, I stopped the path at the www/ folder. It will thus correct files permissions for all of your projects.
Also, make sure to add your current user to the www-data group.
usermod -a -G www-data user_name
Try this, and tell us if you still have your problem.
I am batch uploading files to an FTP server with find and curl using this command:
find /path/to/target/folder -not -path '*/\.*' -type f -exec curl -u username:password --ftp-create-dirs -T {} ftp://ftp.myserver.com/public/{} \;
The problem is find is outputting paths like
/full/path/from/root/to/file.txt
so on the FTP server I get the file uploaded to
ftp.myserver.com/public/full/path/from/root/to/file.txt
instead of
ftp.myserver.com/public/relative/path/to/file.txt
The goal was to have all files and folders that are in the target folder get uploaded to the public folder, but this problem is destroying the file structure. Is there a way to edit the find output to trim the path before it gets fed into curl?
Not sure exactly what you want to end up with in your path, but this should give you an idea. The trick is to exec sh to allow you to modify the path and run a command.
find . -type f -exec sh -c 'joe=$(basename {}); echo $joe' \;
With composer, i tried to install Sylius via sylius/sylius and sylius/sylius-standard.
Installations have both ended like this :
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
It happens just after the parameters.ini initialization.
And after, the command line doesn't work (example : "app/console list" return nothing) although I'm in the project root directory.
Any idea, please ? Thanks.
I've gotten this error ( I'm not sure if it's the same place where your getting it ) and developed a solution that seems to work. Instead of running app/console cache:clear ( which I think gets run at the end of the composer install ), I run a bash script that opens the permissions before and after.
sudo sh clearCache
Contents of clearCache:
#!/bin/bash
chmod -R 777 app/cache/ app/logs/
su www-data -c "app/console cache:clear -e dev"
chmod -R 777 app/cache/ app/logs/
su www-data -c "app/console cache:clear -e prod"
chmod -R 777 app/cache/ app/logs/
I think I got this message during a composer install and was still able to continue via cd Sylius and app/console sylius:install. Just run this before and after installing and updates.