Skip to content

Getting the correct path to the m365 executable #2

@martinlingstuyl

Description

@martinlingstuyl

Hi @anoopt,

I'm in the situation where I'm using NVM to switch between node versions. This would normally lead to me having to reinstall the CLI (and other globally installed tools) every time I switch. Which I dislike.

What I've done instead, is install the CLI and those other tools (yo, gulp-cli, etc) as a local installation in a central folder on my system.
I've added that folder to the PATH env variable.

Now I can just run m365 from that folder and I am not bound to the global cache.

However, this leads to a problem when updating the CLI Predictor

In CLI.Microsoft365.PowerShell.Predictor/src/CLI.Microsoft365.PowerShell.Predictor.Module/CLI.Microsoft365.PowerShell.Predictor/scripts/Update-CLIMircosoft365Predictions.ps1 the predictor retrieves the docfiles by looking at the global path:

# line 19
$m365cliDocsPath = Join-Path $(npm root -g) -ChildPath "@pnp\cli-microsoft365\docs\docs\cmd";

Would it be ok to change this? We can locate the m365.ps1 file by running:

$m365ExecutableFilePath = (Get-command -Name m365).Path

It would be easy to locate the docs folder from there.

Just a thought. It would help me if we did it like that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions