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

Interface 'Localheinz\Json\Normalizer\NormalizerInterface' not found exception #68

Closed
aviator-ua opened this issue May 21, 2018 · 25 comments
Assignees
Labels

Comments

@aviator-ua
Copy link

Steps required to reproduce the problem

  1. Go PHP 7.1
  2. composer global require localheinz/composer-normalize
  3. composer update

Expected Result

  • Normal composer update output

Actual Result

  • Fatal error: Interface 'Localheinz\Json\Normalizer\NormalizerInterface' not found in /Users/user/.composer/vendor/localheinz/composer-normalize/src/Normalizer/ComposerJsonNormalizer.php on line 20
@localheinz
Copy link
Member

localheinz commented May 22, 2018

@aviator-ua

Thank you for your report!

I have tried to reproduce the issue, and after deleting my global composer files with

$ rm -rf ~/.composer

I ran the following steps

$ php -v

PHP 7.1.16 (cli) (built: Mar 31 2018 02:28:54) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.16, Copyright (c) 1999-2018, by Zend Technologies

$ composer --version

Composer version 1.6.5 2018-05-04 11:44:59

$ composer global info

Changed current directory to /Users/am/.composer
Composer could not find a composer.json file in /Users/am/.composer
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

$ composer global require localheinz/composer-normalize

Changed current directory to /Users/am/.composer
Using version ^0.8.0 for localheinz/composer-normalize
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 5 installs, 0 updates, 0 removals
  - Installing sebastian/diff (3.0.0): Downloading (100%)
  - Installing localheinz/json-printer (2.0.0): Downloading (100%)
  - Installing justinrainbow/json-schema (5.2.7): Downloading (100%)
  - Installing localheinz/json-normalizer (0.6.0): Downloading (100%)
  - Installing localheinz/composer-normalize (0.8.0): Downloading (100%)
Writing lock file
Generating autoload files

$ composer normalize

Composer could not find a composer.json file in /Users/am
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section

That is, I have been unable to reproduce the issue.

Can you try again, or maybe also share the output of

$ composer global info --direct

?

@localheinz localheinz added the bug label May 22, 2018
@localheinz localheinz self-assigned this May 22, 2018
@stale
Copy link

stale bot commented Jul 21, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 21, 2018
@localheinz
Copy link
Member

localheinz commented Jul 24, 2018

@ondrejmirtes
Copy link

I have now the same issue in my Travis build: https://travis-ci.org/phpstan/phpstan/jobs/412048416

@localheinz
Copy link
Member

@ondrejmirtes

Taking a look!

@localheinz
Copy link
Member

@ondrejmirtes

I have been able to reproduce the issue, running

$ git clone git@github.com:phpstan/phpstan.git
$ cd phpstan
$ composer install
$ composer validate

yields

PHP Fatal error:  Interface 'Localheinz\Json\Normalizer\NormalizerInterface' not found in /Users/am/Sites/phpstan/phpstan/vendor/localheinz/composer-normalize/src/Normalizer/ComposerJsonNormalizer.php on line 20

Fatal error: Interface 'Localheinz\Json\Normalizer\NormalizerInterface' not found in /Users/am/Sites/phpstan/phpstan/vendor/localheinz/composer-normalize/src/Normalizer/ComposerJsonNormalizer.php on line 20

Basically, after installing, every composer command fails with this error message. Trying to get to the bottom of this!

@localheinz
Copy link
Member

@ondrejmirtes

It appears that this is an issue with composer, I installed composer at https://github.com/composer/composer/tree/1.6.5, and it works fine. Let me find out what it is!

@localheinz
Copy link
Member

localheinz commented Aug 4, 2018

@ondrejmirtes

Opened Spotted an issue at composer/composer#7516.

@localheinz
Copy link
Member

Possibly fixed by composer/composer@a74b639.

@peter279k
Copy link

peter279k commented Aug 6, 2018

After taking a look at this PR, it seems that the latest Composer version has this issue.

@nicwortel
Copy link

I am running into the same issue after upgrading from Composer 1.6.5 to 1.7.0. Unfortunately I had to manually remove this package in order to get Composer working again.

@localheinz
Copy link
Member

localheinz commented Aug 6, 2018

@nicwortel

This is an issue in composer/composer and has already been fixed with composer/composer@a74b639.

As a workaround, follow @Seldaek's suggestion at composer/composer#7516 (comment):

You can temporarily use composer self-update --snapshot to get the fix, I'll release a tag as soon as composer/composer#7517 gets fixed which should be soon enough.

@WyriHaximus
Copy link
Contributor

Can confirm that hat fix works 👍

@localheinz
Copy link
Member

@WyriHaximus

Great to hear!

For reference, also see ergebnis/test-util#94.

@WyriHaximus
Copy link
Contributor

@localheinz yeah not really keen on updating all my packages temporary, I'll wait @Seldaek releases the next composer version with this fix in it.

@WyriHaximus
Copy link
Contributor

FYI be sure to update composer before restoring cache not after, or the update fails:
image

@localheinz
Copy link
Member

@WyriHaximus

Yes, every composer command fails, unfortunately.

I apologize for any inconvenience!

@Seldaek
Copy link

Seldaek commented Aug 7, 2018

https://github.com/composer/composer/releases/tag/1.7.1 is out now with the fix

@localheinz
Copy link
Member

Thank you, @Seldaek!

@nicwortel
Copy link

Can confirm that the upgrade to Composer 1.7.1 fixed the issue. Thank you @Seldaek and @localheinz for your work! 👍

@localheinz
Copy link
Member

@nicwortel

You are welcome! Apologies again for any troubles.

@WyriHaximus
Copy link
Contributor

Can also confirm that this fixes the issues. Thank you @localheinz and @Seldaek 👍

@ondrejmirtes
Copy link

Thanks everyone 😊

@stale
Copy link

stale bot commented Oct 6, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 6, 2018
@localheinz
Copy link
Member

Closing!

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

No branches or pull requests

7 participants