Проблема при запуске сервера express: ошибка: не удается найти модули 'send / node_modules / debug' в Ubuntu - PullRequest
0 голосов
/ 11 февраля 2020

Делая проект из freeCodeCamp (https://www.freecodecamp.org/news/fullstack-react-blog-app-with-express-and-psql/), мы столкнулись с проблемой при попытке запустить сервер в Ubuntu npm run devstart из каталога Server. Точно такая же конфигурация работает в ma c за исключением версии узла, которая является узлом v12.12.00 в ma c, тогда как ubuntu - 12.14.1

, она выдает следующую ошибку:

internal/modules/cjs/loader.js:796
    throw err;
    ^
Error: Cannot find module 'send/node_modules/debug'
Require stack:
- /home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/send/index.js
- /home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/express/lib/utils.js
- /home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/express/lib/application.js
- /home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/express/lib/express.js
- /home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/express/index.js
- /home/leo/Desktop/sideProjects/supermario-bnb/server/main/app.js
- /home/leo/Desktop/sideProjects/supermario-bnb/server/bin/www
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/send/index.js:16:13)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/send/index.js',
    '/home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/express/lib/utils.js',
    '/home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/express/lib/application.js',
    '/home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/express/lib/express.js',
    '/home/leo/Desktop/sideProjects/supermario-bnb/server/node_modules/express/index.js',
    '/home/leo/Desktop/sideProjects/supermario-bnb/server/main/app.js',
    '/home/leo/Desktop/sideProjects/supermario-bnb/server/bin/www'
  ]
}
[nodemon] app crashed - waiting for file changes before starting...

Каталог клиентов с React

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "react": "^16.12.0",
    "react-dom": "^16.12.0",
    "react-scripts": "3.3.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "proxy": "http://localhost:5000"
}

Каталог серверов с express:

{
  "name": "server",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www",
    "devstart": "nodemon ./bin/www"
  },
  "dependencies": {
    "cookie-parser": "~1.4.3",
    "cors": "^2.8.5",
    "debug": "~2.6.9",
    "express": "~4.16.0",
    "helmet": "^3.15.1",
    "http-errors": "~1.6.2",
    "jade": "~1.11.0",
    "morgan": "~1.9.0",
    "nodemon": "^2.0.2",
    "pg": "^7.8.0"
  }
}

Спасибо за ваше время.

...