cli: `netlify lm:setup` crashes

- Do you want to request a feature or report a bug? Bug

- What is the current behavior? netlify lm:setup crashes.

- If the current behavior is a bug, please provide the steps to reproduce. I ran the following commands in order:

  • apt-get install git-lfs
  • git lfs version
  • netlify plugins:install netlify-lm-plugin
  • netlify lm:install
  • netlify lm:setup

All commands worked except the last one which shows:

Logging into your Netlify account...
Opening https://app.netlify.com/authorize?response_type=ticket&ticket=xxxxxx
---------------------------
Error: Unable to open browser automatically
spawn /home/ether/.local/share/netlify-cli/node_modules/netlify-lm-plugin/node_modules/@netlify/cli-utils/node_modules/cli-ux/lib/xdg-open ENOENT

Please open your browser & open the URL below to login:
https://app.netlify.com/authorize?response_type=ticket&ticket=xxxxxx
---------------------------
TypeError: Cannot read property 'slug' of undefined
    at LmSetup.authenticate (~/.local/share/netlify-cli/node_modules/netlify-lm-plugin/node_modules/@netlify/cli-utils/src/index.js:116:21)
    at async LmSetup.run (~/.local/share/netlify-cli/node_modules/netlify-lm-plugin/lib/commands/lm/setup.js:24:29)
    at async LmSetup._run (~/.local/share/netlify-cli/node_modules/netlify-lm-plugin/node_modules/@netlify/cli-utils/node_modules/@oclif/command/lib/command.js:34:20)
    at async Config.runCommand (~/.nvm/versions/node/v12.10.0/lib/node_modules/netlify-cli/node_modules/@oclif/config/lib/config.js:151:9)
    at async Main.run (~/.nvm/versions/node/v12.10.0/lib/node_modules/netlify-cli/node_modules/@oclif/command/lib/main.js:21:9)
    at async Main._run (~/.nvm/versions/node/v12.10.0/lib/node_modules/netlify-cli/node_modules/@oclif/command/lib/command.js:44:20)

- What is the expected behavior? netlify lm:setup should not crash

- Local Environment Information Paste the results of netlify status --verbose here

──────────────────────┐
 Current Netlify User │
──────────────────────┘
Name:  ehmicky
Email: [edited]
Teams: 
  ehmicky's team: Owner Collaborator Controller

────────────────────┐
 Environment Info   │
────────────────────┘

  System:
    OS: Linux 5.0 Ubuntu 19.04 (Disco Dingo)
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
  Binaries:
    Node: 12.10.0 - ~/.nvm/versions/node/v12.10.0/bin/node
    npm: 6.11.3 - ~/.nvm/versions/node/v12.10.0/bin/npm
  Browsers:
    Chrome: 76.0.3809.132
    Firefox: 69.0

────────────────────┐
 Netlify Site Info  │
────────────────────┘
Current site: [edited]
Netlify TOML: /home/ether/code/cv-website/netlify.toml
Admin URL:    https://app.netlify.com/sites/[edited]
Site URL:     [edited]
Site Id:      418b94bc-93cd-411a-937a-ae4c734f17c4

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 10
  • Comments: 20 (8 by maintainers)

Most upvoted comments

Hi all 👋 and sorry for the delay in fixing this. CLI version 3.8.0 address this issue. Please comment if you’re still experiencing issues after running:

npm i -g netlify-cli
netlify lm:setup

Hey everyone

Found a workaround that worked for me on Mac.

  • added NETLIFY_AUTH_TOKEN as and environment variable to terminal
  • since I was having issues with npm, I ran it in yarn yarn add @netlify/cli-utils@latest in ~/.local/share/netlify-cli
  • after that, navigated back to the already linked folder and ran netlify lm:setup and it FINALLY worked.

I suspect for me is because I am behind some versions on npm maybe since running npm i -g netlify-cli@latest resulted in some npm warnings.

Hope it helps some of you.

I believe some people have reported using an auth token copied from the web UI resolved the issue for them:

https://docs.netlify.com/cli/get-started/#obtain-a-token-in-the-netlify-ui

Hey @overlordofmu, could you expand on this? Setting this env var does not make any difference for me:

$ NETLIFY_AUTH_TOKEN=my_auth_token netlify lm:setup
Logging into your Netlify account...
Opening https://app.netlify.com/authorize?response_type=ticket&ticket=qwertyuiopkjhgfdsazxcvbnm
    TypeError: Cannot read property 'slug' of undefined

Is this what I should be doing, or is the workaround different somehow?

It is only a workaround but it does get some people “working” again while a fix in the CLI tool is being developed.

We’ve been able to reproduce the issue and we’re working on a fix as we speak. We’ll update this issue as soon as it’s fixed.

Thanks for your patience and for the detailed information! 🙌🏻

I’m seeing exactly the same problem on Ubuntu 20.04.