Closed phpcss-ankue closed 11 months ago
Sounds like you're using a non-quoted path that contains spaces, eg
C:\Program Files\...
instead of
"C:\Program Files\..."
While Upgrade tool can be fixed to escape $cmdPath
here, Rector will fail to load --autoload-file
or --config
files anyway.
Both your project and Upgrade tool must in paths without whitespace.
Thank you for the fast replies.
I have thought about this, the paths I am using are:
cake upgrade rector --rules cakephp45 "C:\users\myusername\source\repos\pld\src"
The upgrade tool lies in: C:\users\myusername\source\repos\upgrade
. There is no whitespace.
I assume that some file is called that is supposed to lie in one of the paths but is absent and cmd is searching at C:\Program Files
(which is not escaped). I could not find which one, though.
You can run bin/cake upgrade rector
with --verbose
to see what command is used to run Rector.
Then run that vendor/bin/rector process
with --debug
to see what Rector does when it fails.
I have just run rector process --autoload-file="C:\Users\myusername\source\repos\pld/vendor/autoload.php" --config="C:\Users\myusername\source\repos\upgrade/config/rector/cakephp45.php" "C:\Users\myusername\source\repos\pld\src" --debug
in C:\Users\myusername\source\repos\upgrade\vendor\bin>
. Still only the notification: 'The command "C:\Program" is either misspelled or could not be found.'
Add: also running the rector process explicitly as C:\Users\myusername\source\repos\upgrade/vendor/bin/rector process ...
does not help.
Rector uses composer/xdebug-handler
to restart process without XDebug. But xdebug-handler fails to escape command. Your php.exe
is likely in C:\Program Files
.
To disable restart, either run Rector with --xdebug
or add environment variable RECTOR_ALLOW_XDEBUG
:
set RECTOR_ALLOW_XDEBUG=1
on Windowsexport RECTOR_ALLOW_XDEBUG=1
on Linux, macOS, CygwinThank you! That solved the issue. Ran smoothly setting the environment variable.
I wanted to upgrade my cakephp project (currently 4.4.18, I have updated dependencies to cakephp 4.5.0) using rector (0.16.0) on Windows cmd. When running
bin\cake upgrade rector --rules cakephp45 "<path\to\app>
I receive the error: 'The command "C:\Program" is either misspelled or could not be found.'. Nevertheless, 'Rector applied successfully' is displayed but no changes are made to the src code. I am running current php v8.2.11. I have installed upgrade tool as described under 4.0 Upgrade Guide - 4.x