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

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 !

Related

No definite solution on Windows for Cannot find module 'graceful-fs' Error on React Native App Create Start Up

`PS C:\Users\Adrien\Documents\ReactNativeProjects> npx react-native start
node:internal/modules/cjs/loader:1042
throw err;
^
Error: Cannot find module 'graceful-fs'
Require stack:
- C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js
- C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\bin.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at _gracefulFs (C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js:15:39)
at Object.<anonymous> (C:\Users\Adrien\AppData\Local\npm-cache\_npx\7930a8670f922cdb\node_modules\#react-native-community\cli\build\tools\gracefulifyFs.js:22:1) at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Adrien\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\tools\\gracefulifyFs.js',
'C:\\Users\\Adrien\\AppData\\Local\\npm-cache\\_npx\\7930a8670f922cdb\\node_modules\\#react-native-community\\cli\\build\\bin.js'
]
}
Node.js v18.13.0
Everytime I tried to create an App I got this as a response.
I tried to Open a Project like,
npx react-native init App2
I was expecting was for the project to get built, appear so that I could see all the project files.
I tried uninstalling and then reinstalling like,
npm install 'graceful-fs'
I tried the other solutions here too like apt-get or sudo and curl but it didn't work in my terminal`

Cannot find module 'fs/promises' using 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

maplibre build-dev "TypeError: defaultLoader is not a function"

Getting the error below trying to build maplibre on my Windows box. Followed the CONTRIBUTING.md steps (node, windows-dev-tools, npm i, ...) and I'm currently stuck on this error.
I've paved clean the repo, reinstalled node / windows-dev-tools, ... but it still occurs.
I'm a noob in node.js / rollup, so how can I debug this further?
d:\gdev\maplibre-gl-js>npm run build-dev
> maplibre-gl#2.1.7 build-dev
> rollup --configPlugin #rollup/plugin-typescript -c --environment BUILD:dev --verbose
[!] TypeError: defaultLoader is not a function
TypeError: defaultLoader is not a function
at Object.require.extensions.<computed> [as .ts] (d:\gdev\maplibre-gl-js\node_modules\rollup\dist\shared\loadConfigFile.js:617:13)
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)
at require (node:internal/modules/cjs/helpers:102:18)
at loadConfigFromBundledFile (d:\gdev\maplibre-gl-js\node_modules\rollup\dist\shared\loadConfigFile.js:622:42)
at loadConfigFile (d:\gdev\maplibre-gl-js\node_modules\rollup\dist\shared\loadConfigFile.js:565:11)
at Object.loadAndParseConfigFile (d:\gdev\maplibre-gl-js\node_modules\rollup\dist\shared\loadConfigFile.js:545:21)
at getConfigs (d:\gdev\maplibre-gl-js\node_modules\rollup\dist\bin\rollup:1691:39)
at runRollup (d:\gdev\maplibre-gl-js\node_modules\rollup\dist\bin\rollup:1665:43)

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.

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