0

Учу реакт и хочу разобраться в готовом решении, взял из гита(https://github.com/Krivega/react-redux-shop), вроде делаю всё правильно сначала npm install потом npm start. Но приложение крашиться Пробовал чистить кеш и удалять node_modules и package-lock всё тоже самое. Где туплю? Для инфы использую VS code(может быть я что то не установил?) П.С. такое происходит со всем проектами, даже если они 100% рабочие

Лог ошибки:

`internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module './server.config'
Require stack:
- C:\Users\gleba\Desktop\react-redux-shop\mailer.js
- C:\Users\gleba\Desktop\react-redux-shop\server-app.js
- C:\Users\gleba\Desktop\react-redux-shop\bin\www
    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> (C:\Users\gleba\Desktop\react-redux-shop\mailer.js:2:60)
    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) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\gleba\\Desktop\\react-redux-shop\\mailer.js',
    'C:\\Users\\gleba\\Desktop\\react-redux-shop\\server-app.js',
    'C:\\Users\\gleba\\Desktop\\react-redux-shop\\bin\\www'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start-server: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start-server script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\gleba\AppData\Roaming\npm-cache\_logs\2020-06-16T15_35_14_257Z-debug.log
ERROR: "start-server" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `npm-run-all -p start-server watch-css start-js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\gleba\AppData\Roaming\npm-cache\_logs\2020-06-16T15_35_16_856Z-debug.log`

файл package.json

`{
  "name": "react-redux-shop",
  "description": "Implementation of an online store in the infrastructure of react-redux",
  "version": "0.1.0",
  "keywords": [
    "reactjs",
    "redux"
  ],
  "contributors": [
    {
      "name": "Krivega Dmitriy",
      "email": "[email protected]",
      "web": "http://krivega.com/"
    }
  ],
  "demos": [
    "http://midforest.krivega.com/"
  ],
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/Krivega/react-redux-shop.git"
    }
  ],
  "private": true,
  "proxy": {
    "/api": {
      "target": "http://localhost:9000"
    }
  },
  "dependencies": {
    "@material/animation": "^0.25.0",
    "@material/button": "^0.29.0",
    "@material/elevation": "^0.28.0",
    "@material/fab": "^0.29.0",
    "@material/layout-grid": "^0.24.0",
    "@material/list": "^0.29.0",
    "@material/theme": "^0.29.0",
    "@material/typography": "^0.28.0",
    "cors": "^2.8.4",
    "express": "^4.16.2",
    "express-http-proxy": "^1.1.0",
    "history": "^4.7.2",
    "husky": "^0.14.3",
    "immutable": "^3.8.2",
    "lint-staged": "^6.1.0",
    "lodash": "^4.17.4",
    "nedb": "^1.8.0",
    "node-sass-chokidar": "0.0.3",
    "nodemailer": "^4.4.2",
    "normalize.css": "^7.0.0",
    "npm-run-all": "^4.1.2",
    "prettier": "^1.10.2",
    "prop-types": "^15.6.0",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-intl": "^2.4.0",
    "react-redux": "^5.0.6",
    "react-router": "^4.2.0",
    "react-router-dom": "^4.2.2",
    "react-router-redux": "^5.0.0-alpha.8",
    "react-scripts": "1.1.0",
    "react-swipeable": "^4.2.0",
    "react-transition-group": "^2.2.1",
    "rebem-classname": "^0.4.0",
    "redux": "^3.7.2",
    "redux-immutable": "^4.0.0",
    "redux-saga": "^0.16.0",
    "reselect": "^3.0.1"
  },
  "lint-staged": {
    "src/**/*.{js,jsx,json,scss}": [
      "prettier --write",
      "git add"
    ]
  },
  "scripts": {
    "precommit": "lint-staged",
    "build-css": "node-sass-chokidar src/ -o src/ --include-path=src/ --include-path=node_modules/",
    "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --include-path=src/ --include-path=node_modules/ --watch --recursive",
    "start-js": "react-scripts start",
    "start-server": "node ./bin/www",
    "start": "npm-run-all -p start-server watch-css start-js",
    "build-js": "react-scripts build",
    "build": "npm-run-all build-css build-js",
    "arch-build": "tar -zcvf build.tar.gz build",
    "extract-build": "tar -zxvf build.tar.gz build",
    "build-and-arch": "npm-run-all build arch-build",
    "images": "gulp images",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "devDependencies": {
    "gulp": "^3.9.1",
    "gulp-filter": "^5.1.0",
    "gulp-image": "^4.2.0",
    "gulp-image-resize": "^0.13.0",
    "gulp-rename": "^1.2.2",
    "require-dir": "^0.3.2",
    "run-sequence": "^2.2.1",
    "why-did-you-update": "^0.1.0"
  }
}
`
2
  • вы ошибку заскринили с самого начала или только то место где начинается ERR
    – Vearodev
    16 июн 2020 в 15:29
  • @Vearodev поправил, скинул фулл лог
    – dg g4re
    16 июн 2020 в 15:39

2 ответа 2

0

Error: Cannot find module './server.config' Чекни файл server.config, предполагаю что у тебя там прописан api неправильно(либо твой ключ неверный) и app просто не может к нему обратится, по этому и выбрасывает ошибку. Используй debugger для поиска ошибок (например поставь его перед 969 строкой в loader.js и смотри какие данные приходят).

0

Какая-то дичь) Все проекты отдну и туже ошибку, даже если рабочие... Есть ли бэк у Вашего приложения, если да? то надо и на бэке сделать npm i. Ошибка говорит, что не можеь найти путь к server.config. Я предполагаю, что на бэке утановлен пакет config js из которого и берется Ваш server.config.

Ваш ответ

Нажимая на кнопку «Отправить ответ», вы соглашаетесь с нашими условиями использования и подтверждаете, что прочитали и поняли наши политику конфиденциальности и нормы поведения.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.