I installed node-gyp as a global module npm install node-gyp -g
When I run node-gyp, the bellow issue occurred
current node version 'v15.0.1' Os Ubuntu 20.04.3 LTS
Looking for some help.
node-gyp
node:internal/modules/cjs/loader:903
throw err;
^
Error: Cannot find module 'nopt'
Require stack:
/usr/share/nodejs/node-gyp/lib/node-gyp.js
/usr/share/nodejs/node-gyp/bin/node-gyp.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)
at Function.Module._load (node:internal/modules/cjs/loader:745:27)
at Module.require (node:internal/modules/cjs/loader:972:19)
at require (node:internal/modules/cjs/helpers:88:18)
at Object.<anonymous> (/usr/share/nodejs/node-gyp/lib/node-gyp.js:4:14)
at Module._compile (node:internal/modules/cjs/loader:1083:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Module.require (node:internal/modules/cjs/loader:972:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/share/nodejs/node-gyp/lib/node-gyp.js',
'/usr/share/nodejs/node-gyp/bin/node-gyp.js'
]
}
What helped in my case is running it with su permissions:
sudo node-gyp configure
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With