Fix error `Module build failed: Error: Cannot find module 'ajv'` - node.js

I'm getting the error Module build failed: Error: Cannot find module 'ajv' when trying to run vue-cli-service serve --mode dev in my application.
ajv is being installed as a dependency of other packages, it's not a direct dependency in my package.json. I'm using versions node: v14.17.6 and npm : 6.14.15
npm install runs perfectly, the error only appears when running vue-cli-service serve --mode dev
The full error trace is as follows:
ERROR in ./src/main.ts
Module build failed: Error: Cannot find module 'ajv'
Require stack:
- /Users/<user>/node_modules/schema-utils/dist/validate.js
- /Users/<user>/node_modules/schema-utils/dist/index.js
- /Users/<user>/node_modules/cache-loader/dist/index.js
- /Users/<user>/node_modules/cache-loader/dist/cjs.js
- /Users/<user>/<project>/node_modules/webpack/lib/ProgressPlugin.js
- /Users/<user><project>/node_modules/progress-webpack-plugin/index.js
- /Users/<user><project>/node_modules/#vue/cli-service/lib/commands/serve.js
- /Users/<user>/<project>//node_modules/#vue/cli-service/lib/Service.js
- /Users/<user>/<project>/node_modules/#vue/cli-service/bin/vue-cli-service.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/Users/<user>/node_modules/schema-utils/dist/validate.js:15:13)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/Users/<user>/node_modules/schema-utils/dist/index.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
webpack compiled with 1 error
No issues found.
Any idea what could be the issue?

Related

Vuepress can't find module Require stack:

I'm getting this error when I use the command yarn dev
is there any way to fix this?
PS C:\Users\Maximiliano\Desktop\guia front-end method\docs> yarn dev
yarn run v1.22.19
$ vuepress dev src
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'chalk'
Require stack:
- C:\Users\Maximiliano\Desktop\guia front-end method\docs\node_modules\#vuepress\shared-utils\lib\datatypes.js
- C:\Users\Maximiliano\Desktop\guia front-end method\docs\node_modules\#vuepress\shared-utils\lib\index.js
- C:\Users\Maximiliano\Desktop\guia front-end method\docs\node_modules\vuepress\lib\checkEnv.js
- C:\Users\Maximiliano\Desktop\guia front-end method\docs\node_modules\vuepress\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> (C:\Users\Maximiliano\Desktop\guia front-end method\docs\node_modules\#vuepress\shared-utils\lib\datatypes.js:7:33)
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:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Maximiliano\\Desktop\\guia front-end method\\docs\\node_modules\\#vuepress\\shared-utils\\lib\\datatypes.js',
'C:\\Users\\Maximiliano\\Desktop\\guia front-end method\\docs\\node_modules\\#vuepress\\shared-utils\\lib\\index.js',
'C:\\Users\\Maximiliano\\Desktop\\guia front-end method\\docs\\node_modules\\vuepress\\lib\\checkEnv.js',
'C:\\Users\\Maximiliano\\Desktop\\guia front-end method\\docs\\node_modules\\vuepress\\cli.js'
]
}
error Command failed with exit code 1.
Snapshot of the above error

Error: Cannot find module 'react-router/lib/getRouteParams'

I did npm -install -react-router-dom and all the good nonense, I have react-router in the node modules. I cannot seem to find the solution to this problem.
Below is the Error Code.
Compiling your contracts...
===========================
> Compiling .\src\contracts\EthSwap.sol
> Compiling .\src\contracts\Migrations.sol
> Compiling .\src\contracts\Token.sol
> Artifacts written to C:\Users\ssand\AppData\Local\Temp\test--2500-cjuPSMOV4zat
> Compiled successfully using:
- solc: 0.5.16+commit.9c3226ce.Emscripten.clang
Error: Cannot find module 'react-router/lib/getRouteParams'
Require stack:
- C:\Users\ssand\eth_swap\node_modules\react-bootstrap\lib\Breadcrumb.js
- C:\Users\ssand\eth_swap\test\EthSwap.test.js
- C:\Users\ssand\AppData\Roaming\npm\node_modules\truffle\node_modules\mocha\lib\mocha.js
- C:\Users\ssand\AppData\Roaming\npm\node_modules\truffle\node_modules\mocha\index.js
- C:\Users\ssand\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (C:\Users\ssand\eth_swap\node_modules\react-bootstrap\lib\Breadcrumb.js:28:37)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Object.require.extensions.<computed> [as .js] (C:\Users\ssand\eth_swap\node_modules\babel-register\lib\node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (C:\Users\ssand\eth_swap\test\EthSwap.test.js:8:17)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at loader (C:\Users\ssand\eth_swap\node_modules\babel-register\lib\node.js:144:5)
at Object.require.extensions.<computed> [as .js] (C:\Users\ssand\eth_swap\node_modules\babel-register\lib\node.js:154:7)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at C:\Users\ssand\AppData\Roaming\npm\node_modules\truffle\node_modules\mocha\lib\mocha.js:390:36
at Array.forEach (<anonymous>)
Truffle v5.4.19 (core: 5.4.19)
Node v14.17.5
PS C:\Users\ssand\eth_swap>
npm install react-router-dom --save
If it did not work, try to verify your path env variable and add the directory that you installed react module.

can't find module 'cucumber'

I have installed protractor and cucumber globally.
When I run this code using protractor:
$ protractor ./config/cucumber.conf.js
I get the following error:
[15:54:03] E/configParser - Error code: 105
[15:54:03] E/configParser - Error message: failed loading configuration file ./config/cucumber.conf.js
[15:54:03] E/configParser - Error: Cannot find module 'cucumber'
Require stack:
- D:\AutomationTesting\Cucumberbasics\node_modules\protractor-cucumber-framework\lib\cucumberLoader.js
- D:\AutomationTesting\Cucumberbasics\node_modules\protractor-cucumber-framework\index.js
- D:\AutomationTesting\Cucumberbasics\config\cucumber.conf.js
- C:\Users\Admin-asus\AppData\Roaming\npm\node_modules\protractor\built\configParser.js
- C:\Users\Admin-asus\AppData\Roaming\npm\node_modules\protractor\built\launcher.js
- C:\Users\Admin-asus\AppData\Roaming\npm\node_modules\protractor\built\cli.js
- C:\Users\Admin-asus\AppData\Roaming\npm\node_modules\protractor\bin\protractor
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.module.exports.load (D:\AutomationTesting\Cucumberbasics\node_modules\protractor-cucumber-framework\lib\cucumberLoader.js:19:24)
at Object.<anonymous> (D:\AutomationTesting\Cucumberbasics\node_modules\protractor-cucumber-framework\index.js:8:33)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)`enter code here`
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)

Error: Cannot find module 'extend' when running 'node skeleton build' in terminal

When Im compiling my .less file, I need to run node skeleton build in terminal, but instead of compiling, this error occur:
Building target: default
=============== ERROR ===============
{ Error: Cannot find module 'extend'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/opt/lampp/htdocs/htlgi_london/lib/build/getSettings.js:3:14)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3) code: 'MODULE_NOT_FOUND' }
Please show me how to solve this problem.

Electron sqlite3 package app module not found

When I run the packaged electron app for windows(which includes sqlite3), I get the following error:
Knex: run
$ npm install sqlite3 --save
Error: Cannot find module 'C:\Users\User\Desktop\Shoppinglist2-win32-ia32\resour
ces\app.asar\node_modules\sqlite3\lib\binding\electron-v2.0-win32-ia32\node_sqli
te3.node'
at Module._resolveFilename (module.js:543:15)
at Function.Module._resolveFilename (C:\Users\User\Desktop\Shoppinglist2-win
32-ia32\resources\electron.asar\common\reset-search-paths.js:35:12)
at Function.Module._load (module.js:473:25)
at Module.require (module.js:586:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\User\Desktop\Shoppinglist2-win32-ia32\resour
ces\app.asar\node_modules\sqlite3\lib\sqlite3.js:4:15)
at Object.<anonymous> (C:\Users\User\Desktop\Shoppinglist2-win32-ia32\resour
ces\app.asar\node_modules\sqlite3\lib\sqlite3.js:190:3)
at Module._compile (module.js:642:30)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (module.js:586:17)
at require (internal/module.js:11:18)
at Client_SQLite3._driver (C:\Users\User\Desktop\Shoppinglist2-win32-ia32\re
sources\app.asar\node_modules\knex\lib\dialects\sqlite3\index.js:75:12)
at Client_SQLite3.initializeDriver (C:\Users\User\Desktop\Shoppinglist2-win3
2-ia32\resources\app.asar\node_modules\knex\lib\client.js:219:26)
If I package the app for Linux it workes fine.
PS: Sqlite3 is included as a normal dependency and if i execute the app by npm start it workes fine. And I took care of the rebuild process
Thank you :-)

Resources