NodeJS internal/modules/cjs/loader:936 -> throw err;[已关闭]

tvz2xvvm  于 2023-08-04  发布在  Node.js
关注(0)|答案(1)|浏览(328)

此问题是由打印错误或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这一个是解决的方式不太可能帮助未来的读者。
5天前关闭。
Improve this question
我有一个项目在NodeNEST.js
我通过运行npm run start:dev命令来处理这个项目。
这个项目进行了一个多月,工作顺利。
但两天前,突然,服务器宕机,然后,npm run start:dev的命令不运行应用程序!
并给出这个错误:
`
PS C:\Users\elman\Desktop\atest> npm run start:dev
nest-documentations@0.0.1 start:dev
嵌套开始--监视
node:internal/modules/cjs/loader:936
抛出错误;
^
错误:找不到模块“functions.js”

  • C:\Users\elman\Desktop\atest\node_modules\fork-ts-checker-webpack-plugin\lib\issue\issue-webpack-error.js
  • C:\Users\elman\Desktop\atest\node_modules\fork-ts-checker-webpack-plugin\lib\hooks\tap-after-compile-to-get-issues.js
  • C:\Users\elman\Desktop\atest\node_modules\fork-ts-checker-webpack-plugin\lib\hooks\tap-start-to-run-workers.js
  • C:\Users\elman\Desktop\atest\node_modules\fork-ts-checker-webpack-plugin\lib\plugin.js
  • C:\Users\elman\Desktop\atest\node_modules\fork-ts-checker-webpack-plugin\lib\index.js
  • C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\lib\compiler\defaults\webpack-defaults. js
  • C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\lib\compiler\webpack-compiler. js
  • C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\actions\build.action.js
  • C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\actions\index. js
  • C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\commands\command.loader. js
  • C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\commands\index. js
  • C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\bin\nest. 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.(C:\Users\elman\Desktop\atest\node_modules\fork-ts-checker-webpack-plugin\lib\issue\issue-webpack-error. js:9:35)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\elman\Desktop\test\node_modules\fork-ts-checker-webpack-plugin\lib\issue\issue-webpack-error.js',' C:\Users\elman\Desktop\test\node_modules\fork-ts-checker-webpack-plugin\lib\hooks\tap-after-compile-to-get-issues.js',ebpack-compiler.js','C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\actions\build。开拍js',' C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\actions\index。js','C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\commands\command。装载机js',' C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\commands\index。js','C:\Users\elman\Desktop\atest\node_modules@nestjs\cli\bin\nest。js']}`
My Package. json:

{
  "name": "nest-documentations",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "prisma": {
    "seed": "ts-node ./prisma/seed.ts"
  },
  "scripts": {
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json",
    "test:e2e:watch": "jest --config ./test/jest-e2e.json --watch",
    "seed:config": "ts-node ./node_modules/typeorm-seeding/dist/cli.js config -n src/config/ORMs/typeORM/typeorm-config.migrations.ts",
    "seed:run": "ts-node ./node_modules/typeorm-seeding/dist/cli.js seed      -n src/config/ORMs/typeORM/typeorm-config.migrations.ts"
  },
  "dependencies": {
    "@casl/ability": "^6.5.0",
    "@nestjs/common": "^9.0.0",
    "@nestjs/config": "^2.3.4",
    "@nestjs/core": "^9.0.0",
    "@nestjs/event-emitter": "^2.0.0",
    "@nestjs/jwt": "^10.1.0",
    "@nestjs/mapped-types": "*",
    "@nestjs/passport": "^10.0.0",
    "@nestjs/platform-express": "^9.0.0",
    "@nestjs/platform-socket.io": "^10.1.2",
    "@nestjs/schedule": "^3.0.1",
    "@nestjs/serve-static": "^4.0.0",
    "@nestjs/typeorm": "^10.0.0",
    "@nestjs/websockets": "^10.1.2",
    "@ngneat/falso": "^6.4.0",
    "@prisma/client": "^4.16.1",
    "@types/multer": "^1.4.7",
    "@types/socket.io": "^3.0.2",
    "bcrypt": "^5.1.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.14.0",
    "joi": "^17.9.2",
    "passport": "^0.6.0",
    "passport-jwt": "^4.0.1",
    "passport-local": "^1.0.0",
    "pg": "^8.11.0",
    "pg-query-stream": "^4.5.0",
    "prisma-import": "^1.0.4",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^7.2.0",
    "typeorm": "^0.3.16",
    "typeorm-seeding": "^1.6.1"
  },
  "devDependencies": {
    "@nestjs/cli": "^9.0.0",
    "@nestjs/schematics": "^9.0.0",
    "@nestjs/testing": "^9.4.3",
    "@types/express": "^4.17.13",
    "@types/jest": "29.2.4",
    "@types/node": "18.11.18",
    "@types/passport-jwt": "^3.0.8",
    "@types/passport-local": "^1.0.35",
    "@types/supertest": "^2.0.11",
    "@typescript-eslint/eslint-plugin": "^5.0.0",
    "@typescript-eslint/parser": "^5.0.0",
    "eslint": "^8.0.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "jest": "29.3.1",
    "prettier": "^2.3.2",
    "prisma": "^4.16.1",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-jest": "29.0.3",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig-paths": "4.1.1",
    "typescript": "^4.7.4"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

字符串
我找了两天,但我不能解决问题或找到原因。
node_modules的目录存在于项目中。所有软件包都安装在这里。它体积大约是700MB!.
在此之前,该项目是通过这些安装的软件包工作的。
我没有安装或删除任何软件包之前,这突然错误!
当我尝试通过npm i命令重新安装时,它给出ERROR!我很困惑!
注意:当我删除node_modules目录并通过npm i重新安装时,此error发生:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: nest-documentations@0.0.1
npm ERR! Found: typeorm@0.3.17
npm ERR! node_modules/typeorm
npm ERR!   typeorm@"^0.3.16" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer typeorm@"^0.2.24" from typeorm-seeding@1.6.1
npm ERR! node_modules/typeorm-seeding
npm ERR!   typeorm-seeding@"^1.6.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\elman\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\elman\AppData\Local\npm-cache\_logs\2023-07-28T08_31_45_576Z-debug-0.log

fivyi3re

fivyi3re1#

我解决了我的问题
在某些情况下,有些人建议我们应该删除node_modules目录,然后通过npm i重新安装所有软件包。但对我不起作用。
在其他一些情况下,有些人建议我应该删除C:\Users\elman\AppData\Roaming目录中的npm-cache文件夹,其中包含缓存。但这一次也没有成功!
我安装了webpack npm i webpack。然后问题解决了。给予注意,它是本地安装,而不是全局安装。Webpack package,全局存在于我的系统中。
我不明白的一个问题是:这个项目一直在工作。这个错误,突然发生,我没有安装或删除任何新的软件包,我不操纵任何东西在项目构造器或package.json!这个错误的原因对我来说仍然是个谜!

相关问题