CloudShell
CloudShell copied to clipboard
[BUG] Loading the Microsoft 365 CLI in Azure Cloud Shell
To Reproduce
Start up the CLI in either Bash or PS
m365 -v
Observed Behavior
username@Azure:~$ m365 -v
/usr/local/lib/node_modules/@pnp/cli-microsoft365/node_modules/webidl-conversions/lib/index.js:357
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at Module.patchedRequire [as require] (/usr/local/lib/node_modules/@pnp/cli-microsoft365/node_modules/diagnostic-channel/dist/src/patchRequire.js:14:46)
at require (internal/module.js:11:18)
Expected behavior
Returning the version of the Microsoft 365 CLI that is available in the Shell
Is this specific to Cloud Shell?
Not quite sure, the Microsoft 365 CLI is working on other platforms so it looks like it is related to the recent changes in the base image.
Interface information
How are you accessing Cloud Shell - https://shell.azure.com, https://portal.azure.com, via Windows Terminal, or some other method? The error occurs in all scenarios (shell, portal and Windows terminal). Browser is Edge Dev latest release on Windows Version 10.0.19042. Windows Terminal Version: 1.4.3243.0
Additional context
N/a
Pondering a bit on the issue it might be related to the node version (v8.16.0) in the base image, any change we could bump that to LTS? Or would that be something more suited for a discussion?
I think your diagnosis is right - m365 has raised required node version above the rather old version we include. Updating node is the correct fix. Because node is also used to implement the app which connects the container to the browser, we have to check fairly carefully that nothing will break when we update it. I will look at that in the new year.
@edyoung
Appreciate that this may not be on a priority list, however is it possible to give us an idea on whether this it is in your short term plans to update the node version in Azure Shell to LTS?
We would love to continue to promote the use of Azure Shell with the CLI for Microsoft 365 target audience however in its current state this is not possible.
Let us know if you need any assistance from us, we will be more than happy to help 👍🏻
While I would like to fix right away, realistically it is medium term. You can see the PR above. The main issue as mentioned is validating that the node app which connects Cloud Shell to the browser is not affected by node upgrade. This is somewhat complicated so will take some time. Unfortunately since that piece is not open source it's not easy to collaborate on.
Thanks for the update @edyoung much appreciated 👍🏻
Not sure if this helps you at all, but one of our contributors has found a workaround by using nvm
to install the LTS version of node in the Cloud Shell and all appears to be working fine.
https://github.com/pnp/cli-microsoft365/issues/2017#issuecomment-776484351
Hey @edyoung, any update when we can expect #67 to be merged?
Hey @edyoung . It is good that the PR is ready to be merged. Totally appreciate your effort on that.
Any timeline of which you can think on this so that we can leverage CLI for M365 scripts for one of our use case.
Hi @edyoung, any updates on this? I see the PR is still open.
Linked PR has been closed https://github.com/Azure/CloudShell/pull/67#issuecomment-1167650340
We are tracking this internally and these changes will happen when we move to CBL-Mariner: microsoft/CBL-Mariner