Command not found: moralis-admin-cli

Hello, I successfully run yarn global add moralis-admin-cli but when I run moralis-admin-cli or yarn moralis:sync I got this error: command not found: moralis-admin-cli & error Command “moralis:sync” not found.

It was recommended from other discussions to try running npm install global moralis-admin-cli it was successfully installed also but still getting same error.

Any Suggestions?

Did you tried restarting your terminal ?

Yes @qudusayo but still getting command not found: moralis-admin-cli

From the error above, looks like it’s a different command you tried. Maybe adding sudo as admin sudo npm i -g moralis-admin-cli should get it installed just like a short form of the mentioned command above.

hello @qudusayo yes i tried but still getting same error when running moralis-admin-cli

here is my repo https://github.com/zahraha97/nextjs-nft-marketplace

you can try to use npx moralis-admin-cli ...

1 Like

Thanks @cryptokid yes this works… I add “moralis:sync” to my scripts in package.json . Any idea of how can I run the command where they ask me for API Key? to connect into hardhat…

package.json

{
  "name": "test",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "moralis:sync": "moralis-admin-cli connect-local-devchain --chain hardhat --moralisSubdomain ngznnjxxrunb.usemoralis.com --frpcPath ./frp/frpc"
  },
  "dependencies": {
    "@walletconnect/web3-provider": "^1.7.8",
    "@web3auth/web3auth": "^1.1.1",
    "global": "^4.4.0",
    "magic-sdk": "7.0.0",
    "moralis": "^1.9.1",
    "moralis-admin-cli": "^2.1.11",
    "next": "12.2.3",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-moralis": "^1.4.0",
    "web3uikit": "^0.1.170"
  },
  "devDependencies": {
    "autoprefixer": "^10.4.7",
    "eslint": "8.20.0",
    "eslint-config-next": "12.2.3",
    "postcss": "^8.4.14",
    "tailwindcss": "^3.1.6"
  }
}

running npx moralis:sync throws this error:

npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "moralis:": moralis:sync

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/zahratest/.npm/_logs/2022-07-28T14_13_49_562Z-debug-0.log

@cryptokid

you could try something like this:
“moralis_sync”: "npx moralis-admin-cli …

@cryptokid
no it didn’t work :confused:

try to run it directly in console then

yes it worked when I run yarn moralis:sync outside frp directory file.

you can change the path to frpc to be the absolute path and run it from anywhere