Netlify cli on Ubuntu, problems installing

Since I dont want to hit quotas, I had to disable the automatic deploy and now I need to use the cli to manually build and deploy

So, I installed nodejs as suggested

sudo apt install nodejs

elect@5800x:~$ nodejs
Welcome to Node.js v12.18.2.

then

npm install netlify-cli -g

elect@5800x:~$  npm install netlify-cli -g
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/netlify-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/netlify-cli/node_modules/@netlify
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/netlify-cli/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/netlify-cli/node_modules/rollup/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-win32-x64@^0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent/node_modules/@netlify/traffic-mesh-agent-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/traffic-mesh-agent-win32-x64@0.27.10: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-darwin-x64@^0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent/node_modules/@netlify/traffic-mesh-agent-darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/traffic-mesh-agent-darwin-x64@0.27.10: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN @octokit/plugin-request-log@1.0.3 requires a peer of @octokit/core@>=3 but none is installed. You must install peer dependencies yourself.

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/netlify-cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/netlify-cli'
npm ERR!  [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/netlify-cli'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/netlify-cli'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/elect/.npm/_logs/2021-02-01T16_14_58_729Z-debug.log

then I tried with sudo

elect@5800x:~$ sudo npm install netlify-cli -g
[sudo] password for elect:
npm WARN deprecated resolve-url@0.2.1: GitHub - lydell/resolve-url: [DEPRECATED] Like Node.jsโ€™ `path.resolve`/`url.resolve` for the browser.
npm WARN deprecated urix@0.1.0: Please see GitHub - lydell/urix: [DEPRECATED] Makes Windows-style paths more unix and URI friendly.
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
/usr/local/bin/ntl โ†’ /usr/local/lib/node_modules/netlify-cli/bin/run
/usr/local/bin/netlify โ†’ /usr/local/lib/node_modules/netlify-cli/bin/run

netlify-cli@3.4.6 postinstall /usr/local/lib/node_modules/netlify-cli
node ./scripts/postinstall.js

Anyone has successfully installed netlify cli on Ubuntu (20.10)?

Hi, @elect86. The sudo example appears successful to me. This Ubuntu 20.04.1 (not 20.10) but my output which is successful is similar to yours:

$ npm install netlify-cli -g
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
/home/username/.nvm/versions/node/v14.0.0/bin/ntl -> /home/username/.nvm/versions/node/v14.0.0/lib/node_modules/netlify-cli/bin/run
/home/username/.nvm/versions/node/v14.0.0/bin/netlify -> /home/username/.nvm/versions/node/v14.0.0/lib/node_modules/netlify-cli/bin/run

> netlify-cli@3.4.6 postinstall /home/username/.nvm/versions/node/v14.0.0/lib/node_modules/netlify-cli
> node ./scripts/postinstall.js


Success! Netlify CLI has been installed!

Your device is now configured to use Netlify CLI to deploy and manage your Netlify sites.

Next steps:

  netlify init     Connect or create a Netlify site from current directory
  netlify deploy   Deploy the latest changes to your Netlify site

For more information on the CLI run netlify help
Or visit the docs at https://cli.netlify.com

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules/netlify-cli/node_modules/rollup/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-darwin-x64@^0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent/node_modules/@netlify/traffic-mesh-agent-darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/traffic-mesh-agent-darwin-x64@0.27.10: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-win32-x64@^0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent/node_modules/@netlify/traffic-mesh-agent-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/traffic-mesh-agent-win32-x64@0.27.10: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN @octokit/plugin-request-log@1.0.3 requires a peer of @octokit/core@>=3 but none is installed. You must install peer dependencies yourself.

+ netlify-cli@3.4.6
added 111 packages from 80 contributors, removed 122 packages, updated 208 packages and moved 1 package in 55.037s


   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                                                                 โ”‚
   โ”‚      New patch version of npm available! 6.14.4 โ†’ 6.14.11       โ”‚
   โ”‚   Changelog: https://github.com/npm/cli/releases/tag/v6.14.11   โ”‚
   โ”‚                Run npm install -g npm to update!                โ”‚
   โ”‚                                                                 โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Now, I am using nvm for switching node versions and my install doesnโ€™t require using sudo. You might consider using nvm as well and then installing the netlify-cli package.

Iโ€™m curious what which netlify returns on your system. This is what I get:

$ which netlify
/home/username/.nvm/versions/node/v14.0.0/bin/netlify

Would you be willing to try the same and post the output here?

What happens if you run

No idea why, but now it works

elect@5800x:~$ netlify

โฌฅ Netlify CLI
Read the docs: https://www.netlify.com/docs/cli
Support and bugs: https://github.com/netlify/cli/issues

Netlify command line tool

VERSION
  netlify-cli/3.4.7 linux-x64 node-v12.18.2

Thanks anyway!

1 Like