MA C OS - Ошибка: не удается найти модуль postgres драйвер - PullRequest
1 голос
/ 21 июня 2020

Я просто изменил свой компьютер с windows на ma c и попытался запустить серверное приложение, основанное на postgresql, и получил следующую ошибку: Ошибка: не удается найти модуль '../driver/postgres/PostgresDriver' . Я установил typeorm и pg и установил postgres, но все же получаю это сообщение.

надеюсь, что кто-нибудь может мне помочь.

Полные ошибки:

Error: Cannot find module '../driver/postgres/PostgresDriver'
Require stack:
- /Users/ohadsahar/Documents/Development/my_app/server/node_modules/typeorm/schema-builder/RdbmsSchemaBuilder.js
- /Users/ohadsahar/Documents/Development/my_app/server/node_modules/typeorm/driver/sqlserver/SqlServerDriver.js
- /Users/ohadsahar/Documents/Development/my_app/server/node_modules/typeorm/migration/MigrationExecutor.js
- /Users/ohadsahar/Documents/Development/my_app/server/node_modules/typeorm/connection/Connection.js
- /Users/ohadsahar/Documents/Development/my_app/server/node_modules/typeorm/connection/ConnectionManager.js
- /Users/ohadsahar/Documents/Development/my_app/server/node_modules/typeorm/index.js
- /Users/ohadsahar/Documents/Development/my_app/server/src/api/models/user.model.ts
- /Users/ohadsahar/Documents/Development/my_app/server/src/api/services/auth.service.ts
- /Users/ohadsahar/Documents/Development/my_app/server/src/api/controllers/auth.controller.ts
- /Users/ohadsahar/Documents/Development/my_app/server/src/api/routes/auth.routes.ts
- /Users/ohadsahar/Documents/Development/my_app/server/src/api/routes/index.ts
- /Users/ohadsahar/Documents/Development/my_app/server/src/app.ts
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/ohadsahar/Documents/Development/my_app/server/src/schema-builder/RdbmsSchemaBuilder.ts:17:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
Waiting for the debugger to disconnect...

Это все ошибки, которые я получаю

Пакет. json:

{
  "name": "my_app_server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "jest",
    "build": "npm run build-ts && npm run copy-static-assets",
    "start": "node dist/app.js",
    "build-ts": "tsc",
    "watch-ts": "npm run copy-static-assets && tsc -w",
    "watch-node": "nodemon",
    "watch": "concurrently -k -p \"[{name}]\" -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold,green.bold\" \"npm run watch-ts\" \"npm run watch-node\"",
    "run-ts": "ts-node src/app.ts",
    "copy-static-assets": "ts-node copyStaticAssets.ts",
    "start:idea": "ts-node $NODE_DEBUG_OPTION --ignore false src/app.ts --env=dev",
    "migration:generate": "ts-node ./node_modules/typeorm/cli migration:generate -n migration -d src/migration -f ./src/config/orm.config.ts",
    "migration:run": "ts-node ./node_modules/typeorm/cli migration:run -f ./src/config/orm.config.ts"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@sendgrid/mail": "^7.2.0",
    "@types/bcryptjs": "^2.4.2",
    "@types/node": "12.11.7",
    "@types/passport": "1.0.0",
    "aws-sdk": "2.463.0",
    "bcrypt-nodejs": "0.0.3",
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.18.3",
    "chance": "^1.1.4",
    "class-transformer": "^0.2.3",
    "class-validator": "^0.11.0",
    "concurrently": "^4.1.0",
    "cors": "^2.8.5",
    "del": "^4.1.1",
    "dotenv": "^8.0.0",
    "express": "^4.16.4",
    "helmet": "^3.21.2",
    "http-status-codes": "^1.3.0",
    "lodash": "^4.17.15",
    "minimist": "^1.2.0",
    "moment": "^2.23.0",
    "morgan": "^1.9.1",
    "multer": "^1.4.2",
    "mysql": "^2.16.0",
    "nodemailer": "^5.0.0",
    "nodemailer-sendgrid-transport": "^0.2.0",
    "passport": "^0.4.0",
    "passport-jwt": "^4.0.0",
    "pg": "^8.0.3",
    "plivo": "^4.6.0",
    "reflect-metadata": "^0.1.12",
    "shelljs": "^0.8.3",
    "typedi": "^0.8.0",
    "typeorm": "0.2.19",
    "typeorm-typedi-extensions": "^0.2.1",
    "winston": "^3.1.0"
  },
  "devDependencies": {
    "@types/bcrypt-nodejs": "0.0.30",
    "@types/bluebird": "^3.5.25",
    "@types/cors": "2.8.6",
    "@types/csv-parse": "^1.1.11",
    "@types/email-templates": "^3.5.0",
    "@types/express": "4.16.0",
    "@types/express-serve-static-core": "4.16.0",
    "@types/helmet": "0.0.42",
    "@types/lodash": "^4.14.119",
    "@types/minimist": "^1.2.0",
    "@types/moment": "^2.13.0",
    "@types/moment-timezone": "^0.5.12",
    "@types/morgan": "^1.7.35",
    "@types/multer": "^1.4.3",
    "@types/nodemailer": "^4.6.5",
    "@types/papaparse": "^4.5.7",
    "@types/passport-jwt": "^3.0.1",
    "@types/pug": "^2.0.4",
    "@types/shelljs": "^0.8.1",
    "@types/winston": "^2.4.4",
    "ts-node": "^7.0.1",
    "tsconfig-paths": "^3.8.0",
    "typescript": "^3.7.5"
  }
}
...