Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Can't run global whisky install on WAMP #58

Open
gpibarra opened this issue Aug 11, 2023 · 7 comments · May be fixed by #61
Open

[Bug] Can't run global whisky install on WAMP #58

gpibarra opened this issue Aug 11, 2023 · 7 comments · May be fixed by #61

Comments

@gpibarra
Copy link
Contributor

Environment

  • OS: Windows 10
  • Shell: PowerShell, Batch, Bash(git - MINGW64)
  • PHP version: 8.1
  • Whisky version: 0.5.1

Step to reproduce

# install global
composer global require projektgopher/whisky

# new repo
mkdir test
cd test
git init 
composer init -n --name=test/test --autoload=src/
echo /vendor/ >> .gitignore
git add .
git commit -m "first commit"

# install whisky.json using global package
whisky install

Error

In Filesystem.php line 59:

  File does not exist at path C:/develop/projects/gepe/vendor/projektgopher/whisky/stubs/whisky.json.

Audit

key value
- Whisky -
installed globally? yes
running globally? no
dogfooding? no
base path C:/develop/projects/test/vendor/projektgopher/whisky/
bin path C:/develop/projects/test/vendor/bin/whisky
- Platform -
cwd C:/develop/projects/test
getGlobalComposerHome C:\Wamp.NET\bin.php\composerHome
getGlobalComposerBinDir C:\Wamp.NET\bin.php\composerHome/vendor/bin
isWindows yes
isNotWindows no
gitIsInitialized yes
gitIsNotInitialized no
- global -
base_path phar://C:/Wamp.NET/bin/7-php_8.1.0_x64/composerHome/vendor/projektgopher/whisky/builds/whisky
normalized base_path phar://C:/Wamp.NET/bin/7-php_8.1.0_x64/composerHome/vendor/projektgopher/whisky/builds/whisky
@gpibarra
Copy link
Contributor Author

Sorry, I don't have time to review it today, tomorrow I'll try to investigate more.

@ProjektGopher
Copy link
Owner

I see two issues here, we're not normalizing the composer paths in our code, and then the directory returned by composer global home/bin doesn't match where it's actually being executed from. Once of the directories in that path must be a symlink

@gpibarra gpibarra changed the title [Bug] Run whisky on Windows with global install [Bug] Can't run whisky install on Windows with global install Aug 11, 2023
@ProjektGopher
Copy link
Owner

I'm glad I added that audit command. This is so much easier to diagnose 💪

@ProjektGopher
Copy link
Owner

I wonder if the easier way to determine isRunningGlobally() is to just search the base_path for 'composerHome' | '.composer' instead of using str_starts_with and passing getGlobalComposerHome.

@ProjektGopher
Copy link
Owner

It seems like composerHome is a non-standard directory name.

https://github.com/composer/composer/blob/main/src/Composer/Factory.php#L45

@ProjektGopher ProjektGopher changed the title [Bug] Can't run whisky install on Windows with global install [Bug] Can't run global whisky install on WAMP Aug 11, 2023
@ProjektGopher ProjektGopher linked a pull request Aug 11, 2023 that will close this issue
@gpibarra
Copy link
Contributor Author

Some comments:

  • This package is not "Wamp", it is "Wamp.NET" (it has the same philosophy but it is another implementation).
  • It effectively uses a symlink on Windows to quickly switch between different versions of PHP (each version of PHP has its own ComposerHome).

@gpibarra
Copy link
Contributor Author

It seems like composerHome is a non-standard directory name.

https://github.com/composer/composer/blob/main/src/Composer/Factory.php#L45

Exactly, Composer for Windows installs the data in C:\Users\(your user)\AppData\Roaming\Composer, and does not set the COMPOSER_HOME environment variable, if it is set that environment variable can be rewritten, but use default location

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants