Import SharePointPnPPowerShellOnline results in error: Could not load type "OfficeDevPnP.Core..."

Help!  I'm suddenly getting an issue ONLY in VS Code and haven't been able to figure it out even after a bunch of RTFM and experimentation (including shutting it down and restarting).  While I can install SharePointPnPPowerShellOnline, when I try to import it, I'm getting the error 


Import-Module : Could not load type 'OfficeDevPnP.Core.Pages.DefaultClientSideWebParts' from assembly 'OfficeDevPnP.Core, Version=3.18.2002.0, Culture=neutral, PublicKeyToken=5e633289e95c321a'.​


Any ideas? I've been through a lot trying to get it to work, including installing SharePoint Client Components, Version 16.0.6906.1200, but keep getting the same result.
2 Replies

Hi @lindabusdiecker ,


Do you have multiple version of SharePoint PnP installed? If yes, please check following article to install side-by-side SharePoint Pnp.


Best Regards,

Riwut Libinuko

@Riwut Libinuko THANK YOU so much for getting back to me. I've actually been running with 2016 and Online for a long time, but am careful to have only one in memory.  Upgraded to Windows 1909 and started being able to import Online in Windows PowerShell and in the ISE.  Still ran into the same issue and more in VS Code, plus ran into some other hokey stuff. Deinstalled and reinstalled VS Code and all versions of SharePointPnPPowerShellOnline. Still had the problem, again, only in VS Code. 

Switched in VS Code from the PowerShell Integrated Console to just powershell, imported successfully, came back to the integrated command console and everything now seems fine (I'm scared to give the "all good" yet ...).  Bizarre. Felt like I was doing the dance of 100 troubleshooting ideas and now I WISH I knew exactly what pieces fixed it in case it might help someone else, but, sigh, I don't know for sure.