"grunt run"이 sudo 모드에서 작동하지 않습니다(Ubuntu 20.04.2)

"grunt run"이 sudo 모드에서 작동하지 않습니다(Ubuntu 20.04.2)
~/Desktop/editify$ sudo -s
root@kritidipto-HP-Laptop-15-bs0xx:/home/kritidipto/Desktop/editify# grunt run
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'liftoff'
Require stack:
- /usr/share/nodejs/grunt-cli/bin/grunt
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/share/nodejs/grunt-cli/bin/grunt:7:15)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/share/nodejs/grunt-cli/bin/grunt' ]
}

Grunt는 sudo 모드에서는 작동하지 않는 것 같지만 루트가 아닐 때는 작동합니다. 권한이 필요한 작업을 수행하기 때문에 루트 사용자를 사용하여 작업하려면 grunt 명령이 필요합니다.

grunt-cli v1.4.3
grunt v0.4.5
node v10.16.0
npm 6.9.0

또한 nvm을 사용하여 여러 버전의 npm 간에 전환합니다.

관련 정보