Error HH12 while trying to run npx hardhat command via ssh using nohup

110 views Asked by At

I'm having issues running npx hardhart command on my remote server via ssh and keeping the node task running while the ssh terminal is closed.

I can remotely connect to my VPS server (Ubuntu 22.04) via ssh and run the following command from the ssh terminal in my hardhat project root directory

npx hardhat run scripts/index.js --network goerli

This ran successfully and the node server was started, But when I try to use nohup to keep the node.js server running while the terminal is closed; in this way

ssh [email protected] "nohup npx hardhat run /var/www/myprojectroot/scripts/index.js --network goerli  > /var/www/outputs/hardhat.out 2>&1 &"

the ssh session closes and I get the following error in /var/www/outputs/hardhat.out

Error HH12: Trying to use a non-local installation of Hardhat, which is not supported.
Please install Hardhat locally using npm or Yarn, and try again.

HardhatError: HH12: Trying to use a non-local installation of Hardhat, which is not supported.
Please install Hardhat locally using npm or Yarn, and try again.
    at main (/root/.npm/_npx/ef9ef3f50c7d7dc1/node_modules/hardhat/src/internal/cli/cli.ts:180:13)
    at Object.<anonymous> (/root/.npm/_npx/ef9ef3f50c7d7dc1/node_modules/hardhat/src/internal/cli/cli.ts:377:1)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Function.Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/root/.npm/_npx/ef9ef3f50c7d7dc1/node_modules/hardhat/src/internal/cli/bootstrap.ts:16:1)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)

The full path of the script is specified in the command, so I don't know why I am having this error.

NB: 10.10.10.10 is just for reference purposes, It's not an actual server IP.

0

There are 0 answers