Error CS0246: Are you missing a using directive or an assembly reference?

Backstory:
I was trying to implement Unity Push Notifications SDK, messing with analytics and firebase… something went wrong, and I’ve got this error first:

Package com.unity.render-pipelines.lightweight@2.0.3-preview has invalid dependencies:
com.unity.render-pipelines.core: Version [2.0.3-preview] is incompatible with the selected version [2.0.0-preview]
One or more packages could not be added to the local file system:
com.unity.render-pipelines.core: Package [com.unity.render-pipelines.core@2.0.0-preview] cannot be found

Next: I’ve found on web that to resolve that I can go Help > Reset Packages to defaults
(I’m working with Plastic SCM - so I relied on it, thinking I can restore everything back anyway) so I pressed on it… and got 200+ errors, like this:

Assets/_DEV/Scripts/LevelsScripts/LevelController.cs(37,12): error CS0246: The type or namespace name 'TextMeshProUGUI' could not be found (are you missing a using directive or an assembly reference?)

I’ve tried to revert my game using version control…but the errors not gone (how can it be?)

Tried to remove manifest.json and packages-lock.json files, so Unity can rebuild them - didn’t help.

Opened another unity project - there is everything ok.

I’m still noob with Unity… tried to resolve this by my self, searching web - without a result…

At a minimum you need to doublecheck you have TextMeshPro in game.

Here’s more things to check:

Extra unwanted packages in new projects (collab, testing, rider and other junk):

About the fastest way I have found to make a project and avoid all this noise is to create the project, then as soon as you see the files appear, FORCE-STOP (hard-kill) Unity (with the Activity Manager or Task Manager), then go hand-edit the Packages/manifest.json file as outlined in the above post, then reopen Unity.

Sometimes the package system gets borked from all this unnecessary churn and requires the package cache to be cleared:

I’ve re-imported packages…and problem solved!