Tag Archives: Summary of error reporting

Error: Cannot find module ‘./application‘ [How to Solve]

1. Background:

Run in PowerShell: PS e: \ vscode \ Vue \ day4 \ code \ myapi & gt; nodemon . \index. JS
error reporting

2. Error reporting content:

PS E:\vscode\vue\day4\code\myapi> node .\index.js
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module './application'
Require stack:
- E:\vscode\vue\day4\code\myapi\node_modules\express\lib\express.js
- E:\vscode\vue\day4\code\myapi\node_modules\express\index.js
- E:\vscode\vue\day4\code\myapi\index.js
[90m    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)[39m
[90m    at Function.Module._load (node:internal/modules/cjs/loader:778:27)[39m
[90m    at Module.require (node:internal/modules/cjs/loader:1005:19)[39m
[90m    at require (node:internal/modules/cjs/helpers:102:18)[39m
    at Object.<anonymous> (E:\vscode\vue\day4\code\myapi\node_modules\[4mexpress[24m\lib\express.js:18:13)
[90m    at Module._compile (node:internal/modules/cjs/loader:1101:14)[39m
[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)[39m
[90m    at Module.load (node:internal/modules/cjs/loader:981:32)[39m
[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)[39m
[90m    at Module.require (node:internal/modules/cjs/loader:1005:19)[39m {
  code: [32m'MODULE_NOT_FOUND'[39m,
  requireStack: [
    [32m'E:\\vscode\\vue\\day4\\code\\myapi\\node_modules\\express\\lib\\express.js'[39m,
    [32m'E:\\vscode\\vue\\day4\\code\\myapi\\node_modules\\express\\index.js'[39m,
    [32m'E:\\vscode\\vue\\day4\\code\\myapi\\index.js'[39m
  ]
}

3. Solution:

1. Prompt for finding the error point: error: cannot find module ‘/ application’
2. According to the error prompt, baidu solved the first blog

4. Causes:

Execute node \index. JS, PowerShell did not find ‘/ Application ‘this module should be index JS file runtime calls
node_ The dependent module in the modules folder is not found, so an error is reported

5. Solution:

1. Delete node_Modules folder (because dependencies are placed here)
2 There is a package Run in the folder of JSON file: PS e:\vscode\Vue\day4\code\myapi > npm install
3. The previous step is based on package JSON file re download dependency