Cannot find module 'fs/promises' using JHipster - jhipster

I'm using nvm and I'm having this error when using jhipster. It was previously working when I'm not using nvm.
jhipster version: v7.9.3
node: v12.22.12
npm: 6.14.16
ERROR! Cannot find module 'fs/promises'
Require stack:
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/generators/bootstrap/index.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/util/esm.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/store.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/environment.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/environment-builder.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/program.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/cli.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/jhipster.js
Error: Cannot find module 'fs/promises'
Require stack:
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/generators/bootstrap/index.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/util/esm.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/store.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/environment.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/environment-builder.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/program.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/cli.js
- /Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/jhipster.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/generators/bootstrap/index.js:29:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
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) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/generators/bootstrap/index.js',
'/Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/util/esm.js',
'/Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/store.js',
'/Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/node_modules/yeoman-environment/lib/environment.js',
'/Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/environment-builder.js',
'/Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/program.js',
'/Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/cli.js',
'/Users/xxxx/.nvm/versions/node/v12.22.12/lib/node_modules/generator-jhipster/cli/jhipster.js'
]
}
Anyone have any idea why is the error and how to fix it? Thanks

I was able to make it work by using node 16.14.2

Related

how to solve this err in hardhat vs code

You are using a version of Node.js that is not supported by Hardhat,
and it may work incorrectly, or not work at all. Please, make sure you
are using a supported version of Node.js. To learn more about which
versions of Node.js are supported go to
https://hardhat.org/nodejs-versions
An unexpected error occurred:
Error: Cannot find module '#nomiclabs/hardhat-waffle'
Require stack:
- D:\3.1\dppa\hardhat.config.js
- D:\3.1\dppa\node_modules\hardhat\internal\core\config\config-loading.js
- D:\3.1\dppa\node_modules\hardhat\internal\cli\cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
at Function.Module._load (node:internal/modules/cjs/loader:780:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (D:\3.1\dppa\hardhat.config.js:1:1)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:827:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'D:\\3.1\\dppa\\hardhat.config.js',
'D:\\3.1\\dppa\\node_modules\\hardhat\\internal\\core\\config\\config-loading.js',
'D:\\3.1\\dppa\\node_modules\\hardhat\\internal\\cli\\cli.js'
]
}
PS D:\3.1\dppa>
It looks like you are trying to run the sample project and are missing plugins.
As stated here, you need to install some plugins for the sample project with the following command.
npm install --save-dev #nomiclabs/hardhat-waffle ethereum-waffle chai #nomiclabs/hardhat-ethers ethers
Besides that, as stated in the provided link, you should use the latest LTS of Node.js, which is Node.js 16 and can be downloaded here

Error: Cannot find module 'code-point-at' while writing any npm commands

Configurations:
System : Ubuntu v21.10
node : v16.14.0
npm : v6.13.7
Problem :
It was working well until last ubuntu software update,Now its throwing "Error: Cannot find module 'code-point-at' while writing any npm commands" because of code: 'MODULE_NOT_FOUND'
I have attached terminal Screenshot,please help me solve this issue.
Terminal:
Terminal Screenshot
ssns#nits-hp-15-notebook-pc:~$ npm --version
node:internal/modules/cjs/loader:933
const err = new Error(message);
^
Error: Cannot find module 'code-point-at'
Require stack:
- /usr/lib/node_modules/npm/node_modules/wide-align/node_modules/string-width/index.js
- /usr/lib/node_modules/npm/node_modules/wide-align/align.js
- /usr/lib/node_modules/npm/node_modules/gauge/lib/render-template.js
- /usr/lib/node_modules/npm/node_modules/gauge/lib/plumbing.js
- /usr/lib/node_modules/npm/node_modules/gauge/lib/index.js
- /usr/lib/node_modules/npm/node_modules/npmlog/lib/log.js
- /usr/lib/node_modules/npm/lib/utils/log-shim.js
- /usr/lib/node_modules/npm/lib/utils/exit-handler.js
- /usr/lib/node_modules/npm/lib/cli.js
- /usr/lib/node_modules/npm/bin/npm-cli.js
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/lib/node_modules/npm/node_modules/wide-align/node_modules/string-width/index.js:3:19)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/lib/node_modules/npm/node_modules/wide-align/node_modules/string-width/index.js',
'/usr/lib/node_modules/npm/node_modules/wide-align/align.js',
'/usr/lib/node_modules/npm/node_modules/gauge/lib/render-template.js',
'/usr/lib/node_modules/npm/node_modules/gauge/lib/plumbing.js',
'/usr/lib/node_modules/npm/node_modules/gauge/lib/index.js',
'/usr/lib/node_modules/npm/node_modules/npmlog/lib/log.js',
'/usr/lib/node_modules/npm/lib/utils/log-shim.js',
'/usr/lib/node_modules/npm/lib/utils/exit-handler.js',
'/usr/lib/node_modules/npm/lib/cli.js',
'/usr/lib/node_modules/npm/bin/npm-cli.js'
]
}
ssns#nits-hp-15-notebook-pc:~$
Thanks in Advance.. :)
I have the same issue on Windows - even npm -v would throw the same error. I'm unable to find the root cause of the issue, but found the following workaround.
I found out that the folder at Program Files\nodejs\node_modules\npm\node_modules\code-point-at was empty for me, even after a clean install of Node. In your case, the directory should be /usr/lib/node_modules/npm/node_modules/code-point-at.
I downloaded a copy of code-point-at from its Github repository at https://github.com/sindresorhus/code-point-at/tags, and manually copied the files into the directory. Once this was done, NPM appears to function normally for me.

Nestjs Yarn build failed Error: Cannot find module './_assignValue'

I tried to start a new project using nestjs and yarn after I run yarn install which is compeleted successfully I run yarn build and here is what I got
The Error :
$ rimraf dist
$ nest build
internal/modules/cjs/loader.js:888
throw err;
^
Error: Cannot find module './_assignValue'
Require stack:
- /home/ashraf/test-project/node_modules/lodash/_copyObject.js
- /home/ashraf/test-project/node_modules/lodash/assignIn.js
- /home/ashraf/test-project/node_modules/lodash/extend.js
- /home/ashraf/test-project/node_modules/inquirer/lib/ui/baseUI.js
- /home/ashraf/test-project/node_modules/inquirer/lib/ui/bottom-bar.js
- /home/ashraf/test-project/node_modules/inquirer/lib/inquirer.js
- /home/ashraf/test-project/node_modules/#nestjs/cli/lib/utils/project-utils.js
- /home/ashraf/test-project/node_modules/#nestjs/cli/actions/generate.action.js
- /home/ashraf/test-project/node_modules/#nestjs/cli/actions/index.js
- /home/ashraf/test-project/node_modules/#nestjs/cli/commands/command.loader.js
- /home/ashraf/test-project/node_modules/#nestjs/cli/commands/index.js
- /home/ashraf/test-project/node_modules/#nestjs/cli/bin/nest.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/ashraf/test-project/node_modules/lodash/_copyObject.js:1:19)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Module.require (internal/modules/cjs/loader.js:957:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/ashraf/test-project/node_modules/lodash/_copyObject.js',
'/home/ashraf/test-project/node_modules/lodash/assignIn.js',
'/home/ashraf/test-project/node_modules/lodash/extend.js',
'/home/ashraf/test-project/node_modules/inquirer/lib/ui/baseUI.js',
'/home/ashraf/test-project/node_modules/inquirer/lib/ui/bottom-bar.js',
'/home/ashraf/test-project/node_modules/inquirer/lib/inquirer.js',
'/home/ashraf/test-project/node_modules/#nestjs/cli/lib/utils/project-utils.js',
'/home/ashraf/test-project/node_modules/#nestjs/cli/actions/generate.action.js',
'/home/ashraf/test-project/node_modules/#nestjs/cli/actions/index.js',
'/home/ashraf/test-project/node_modules/#nestjs/cli/commands/command.loader.js',
'/home/ashraf/test-project/node_modules/#nestjs/cli/commands/index.js',
'/home/ashraf/test-project/node_modules/#nestjs/cli/bin/nest.js'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
In other hand if I tried using npm install and npm run build everything works fine !

Cannot find module

Could somebody help. I have such project structure and my node app complaints about this generated file(error_pb.js). In index.js with 'google-protobuf' I do not have such problem. Is there ideas how to solve it?
my_prj\src\server> node .
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'google-protobuf'
Require stack:
- \my_prj\gen\js\proto\error_pb.js
- \my_prj\src\server\modules\requestHandlers\topicHandler.js
- \my_prj\src\server\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (\my_prj\gen\js\proto\error_pb.js:14:12)
thanks in advance.

When starting a discord bot i get this error

When starting my discord bot that I created a couple years ago I'm getting this error, I've no clue on whats causing it. I have done the uninstall of the node_modules and reinstalling etc but I'm not sure what the error could be caused by, any ideas?
Error:
PS C:\Users\Admin\Documents\Bot> node index.js
internal/modules/cjs/loader.js:960
throw err;
^
Error: Cannot find module 'better-sqlite3'
Require stack:
- C:\Users\Admin\Documents\Bot\node_modules\enmap\src\index.js
- C:\Users\Admin\Documents\Bot\node_modules\enmap\index.js
- C:\Users\Admin\Documents\Bot\index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Module.require (internal/modules/cjs/loader.js:1019:19)
at require (internal/modules/cjs/helpers.js:77:18)
at new Enmap (C:\Users\Admin\Documents\Bot\node_modules\enmap\src\index.js:110:24)
at Object.<anonymous> (C:\Users\Admin\Documents\Bot\index.js:5:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
at Module.load (internal/modules/cjs/loader.js:977:32)
at Function.Module._load (internal/modules/cjs/loader.js:877:14) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Admin\\Documents\\Bot\\node_modules\\enmap\\src\\index.js',
'C:\\Users\\Admin\\Documents\\Bot\\node_modules\\enmap\\index.js',
'C:\\Users\\Admin\\Documents\\Bot\\index.js'
]
}
First make sure better-sqlite3 is installed
npm i better-sqlite3
then that it has been defined
const better-sqlite3 = require('better-sqlite3')

Resources