Back

[SOLVED] Appwrite CLI linux not working

  • 0
  • Tools
Osman
8 Sep, 2023, 07:08

When running: "curl -sL https://appwrite.io/cli/install.sh | bash" I get an error when running appwrite -v:

TypeScript
      throw error;
      ^

Error: Cannot find module '/snapshot/sdk-for-cli/node_modules/axios/dist/node/axios.cjs'
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:960:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:953:15)
    at resolveExports (node:internal/modules/cjs/loader:482:14)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function._resolveFilename (pkg/prelude/bootstrap.js:1819:46)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at Module.require (pkg/prelude/bootstrap.js:1719:31)
    at require (node:internal/modules/cjs/helpers:102:18) {
  code: 'MODULE_NOT_FOUND',
  path: '/snapshot/sdk-for-cli/node_modules/axios/package.json',
  pkg: true
}
TL;DR
Appwrite CLI on Linux was not working initially due to permission errors. The solution was to use `sudo npm install -g appwrite-cli` instead of `npm install -g appwrite-cli`. There were also some issues reported with different versions of Node. Some users mentioned that the CLI worked fine when installed globally through npm and executed with npx. In one case, updating to Node version 16.20.2 did not resolve the error, but it was later discovered that the Ubuntu server was running on Node version 12.22.9. Updating the Node version resolved the issue. Another user suggested that the
safwan
8 Sep, 2023, 07:13
safwan
8 Sep, 2023, 07:14

Seems to work perfectly fine for me. This was a fresh install though

safwan
8 Sep, 2023, 07:14

Maybe try uninstalling the old CLI?

safwan
8 Sep, 2023, 07:15

rm -f /usr/local/bin/appwrite | bash then run curl -sL https://appwrite.io/cli/install.sh | bash

Osman
8 Sep, 2023, 07:20

Hmm uninstalling it does not seem to help. Also tried with npm.. Gives this error when doing appwrite -v:

TypeScript
            if (data[key]?.constructor?.name === 'BigNumber') {
                          ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/appwrite-cli/index.js:11:44)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
Osman
8 Sep, 2023, 07:29

It works fine when installing version 2.0.2, by creating the script locally and replacing 4.0.0 with 2.0.2

Osman
8 Sep, 2023, 07:30

Did you do appwrite -v?

safwan
8 Sep, 2023, 07:32

ah yes I get the same error in this

Osman
8 Sep, 2023, 07:33

Yea, it installs fine, but throws the error when used

Drake
8 Sep, 2023, 16:17

what version of node?

Osman
8 Sep, 2023, 16:19

16.17.0

Drake
8 Sep, 2023, 17:02

FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.

Drake
8 Sep, 2023, 17:08
Drake
8 Sep, 2023, 17:09

something might be weird with your docker version...i would only expect this error on older versiosn of node

Drake
8 Sep, 2023, 17:13

looks like you get the error if you're on node 12

Osman
8 Sep, 2023, 17:46

Noted

Osman
8 Sep, 2023, 17:49

Oh. Thats my bad. I accidently checked the node version of my local pc. It seems that the ubuntu server runs on node 12.22.9. I will update and check soon.

Osman
9 Sep, 2023, 06:22

After updating to node version 16.20.2, i still get the same error when trying to use the appwrite CLI 4.0.0

Osman
9 Sep, 2023, 06:29

It seems to work fine when installing globally through npm and executing with npx. Guess i can just do that instead.

Osman
9 Sep, 2023, 08:39
manazo
24 Sep, 2023, 06:38

for me, npm install -g appwrite-cli thrown some permission errors. so had to do sudo npm install -g appwrite-cli and then it worked fine.

OS: Ubuntu Linux Node: v19.9.0

Drake
25 Sep, 2023, 05:12

[SOLVED] Appwrite CLI linux not working

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more