Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report: cli broken in azure shell #2017

Closed
BassemNKhalil opened this issue Dec 22, 2020 · 5 comments
Closed

Bug report: cli broken in azure shell #2017

BassemNKhalil opened this issue Dec 22, 2020 · 5 comments

Comments

@BassemNKhalil
Copy link
Contributor

Description

Creating a new shell in azure does not provide a working m365 cli

Steps to reproduce

  1. Open portal.azure.com, click on the shell in the top right corner.
  2. Create a storage account if not already created
  3. type m365 help

Expected result

Should provide the help section

Actual result

Error - see below

bassem@Azure:~$ node -v
v8.16.0
bassem@Azure:~$ npm list -g --depth=0
/usr/local/lib
├── @pnp/cli-microsoft365@3.3.0
├── generator-az-terra-module@0.5.0
├── npm@6.4.1
└── yo@3.1.1

npm ERR! peer dep missing: canvas@^2.5.0, required by jsdom@16.4.0
npm ERR! peer dep missing: bufferutil@^4.0.1, required by ws@7.3.1
npm ERR! peer dep missing: utf-8-validate@^5.0.2, required by ws@7.3.1
bassem@Azure:~$ m365 help
/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)

Environment

Bash on Azure Shell
Node v8 (which isn't an option I chose but the default it was created with)

@garrytrinder
Copy link
Member

Thanks for raising @BassemNKhalil

Yes, unfortunately this is the case and we are aware of this, @appieschot has raised an issue in the Azure Cloud Shell Repo which has been acknowledged by the team, I expect that this will be looked into further in the New Year.

Azure/CloudShell#63

Feel free to add to the above issue, I'll leave this issue open so we can track from our side.

Sorry for the trouble, we hope to have this resolved ASAP.

@BassemNKhalil
Copy link
Contributor Author

Thanks @garrytrinder - appreciate the swift response and the linking, didn’t know Azure Cloud Shell had its own repo. I’ll keep an eye on both into the new year, enjoy the holidays!

@BassemNKhalil
Copy link
Contributor Author

BassemNKhalil commented Feb 10, 2021

Just a quick update on my end (seeing the updates here) - I've since worked around this by installing nvm and my own version of node (in my case the latest LTS, to avoid coming back to it often) which seems to be working fine.

I was a bit hesitant at first to try this as I couldn't uninstall the the node version already installed on the shell but given how nvm mainly changes the path I decided to give it a try - so far, it seems to be working without any issues so far.

The whole thing is a couple of lines to install nvm as explained here then installing the latest LTS using nvm install --lts which becomes the default node version (since it is the first installed) and finally installing M365 CLI. From there on, you just open cloud shell and CLI away 🚀 🚀

@waldekmastykarz
Copy link
Member

Thanks for sharing! I'm sure this will help others who are stuck as well.

@waldekmastykarz
Copy link
Member

Azure Shell got updated to Node@16 and CLI is now working as intended. Yay! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants