GithubHelp home page GithubHelp logo

Comments (5)

erwinvanhunen avatar erwinvanhunen commented on May 29, 2024

Hi Rick,

This also sounds me to as some conflict with an earlier installed package of the module. The reason for that is that there are no hardcoded paths in the installer when setting the environment variable. E.g. they are picked up from information during the installation. Can you try to fully uninstall all instances of the cmdlet module (through your control panel), and also make sure there are no references in your PSModulePath left over? Then please reinstall the modules from the latest package available at https://github.com/officedev/pnp-powershell/releases.

from pnp-powershell.

briankinsella avatar briankinsella commented on May 29, 2024

Found a fix.

Had similar problem after uninstalling earlier version and installing Oct 2015 release. Environment variable was set to "C:\Program Files (x86)\OfficeDevPnP.PowerShell.Commands" ; and PowerShell couldn't import module. Kept throwing 'couldn't find' errors.

Adding "C:\Program Files (x86)\OfficeDevPnP.PowerShell.Commands\Modules" to environment variable worked (note addition of \Modules subdirectory to path).

Run the script in this TechNet article to permanently add the path to the PSModulePath environmental variable. I ran this as admin. https://technet.microsoft.com/en-us/library/dd878350%28v=vs.85%29.aspx

from pnp-powershell.

briankinsella avatar briankinsella commented on May 29, 2024

OK - stand corrected. Despite my read of the TechNet article, adding the modified path to PSModulePath using the script only worked for a single PS session - even elevated. So future sessions got same 'couldn't import' error.

So ... old fashioned way: break out text editor & modified PSModulePath in System Properties. Removed "C:\Program Files (x86)\OfficeDevPnP.PowerShell.Commands" and added "C:\Program Files (x86)\OfficeDevPnP.PowerShell.Commands\Modules" Now all's well between PS sessions.

from pnp-powershell.

kilasuit avatar kilasuit commented on May 29, 2024

@briankinsella in my experience thats because powershell will only modify the Current process scope for all $env: unless it is done to the machine scope like below

[Environment]::SetEnvironmentVariable("PSModulePath","$env:PSModulePath;$folderpath","Machine")

Also note that i'm adding to the current PSModulePath in the above
I would then preform a reboot after this to ensure that it has fully taken effect with a simple

shutdown /r /t 2

But thats just how I've experienced it - let me see if I can dig more up on this

from pnp-powershell.

briankinsella avatar briankinsella commented on May 29, 2024

@kilasuit Thank you - very helpful. Yes, current process scope was behavior I was experiencing. This is my first time around the PS environment variables block. Interestingly the technet article I referenced didn't mention the Machine parameter. Anyway, all's well since my brute force editing of PSModulePath in System Properties. Thanks again!

from pnp-powershell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.