Home > OS >  How to run a react project?
How to run a react project?

Time:11-21

I'm trying to run a react project cloned from Github that works with NodeJs. in the readme file, the dev tells that i just need to run 'npm start' on backend folder, then on frontend folder. the problem is that I'm recieving errors:

on backend folder:

$ npm start

> [email protected] start
> nodemon server.js  

[nodemon] 2.0.20
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node server.js`
node:internal/modules/cjs/loader:959
  throw err;
  ^

Error: Cannot find module 'nodemailer'
Require stack:
- C:\Users\alexia.borelvaéhotma\Desktop\stage\Site-centre-formation\backend\utils\emailSend.js
- C:\Users\alexia.borelvaéhotma\Desktop\stage\Site-centre-formation\backend\controllers\user.controllers.js
- C:\Users\alexia.borelvaéhotma\Desktop\stage\Site-centre-formation\backend\routes\userapi.js
- C:\Users\alexia.borelvaéhotma\Desktop\stage\Site-centre-formation\backend\server.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\alexia.borelvaéhotma\Desktop\stage\Site-centre-formation\backend\utils\emailSend.js:1:20)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1028:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\alexia.borelvaéhotma\\Desktop\\stage\\Site-centre-formation\\backend\\utils\\emailSend.js',
    'C:\\Users\\alexia.borelvaéhotma\\Desktop\\stage\\Site-centre-formation\\backend\\controllers\\user.controllers.js',                                                                      ailSend.js',
    'C:\\Users\\alexia.borelvaéhotma\\Desktop\\stage\\Site-centre-formation\\backend\\routes\\urs\\user.controllers.jsserapi.js',
    'C:\\Users\\alexia.borelvaéhotma\\Desktop\\stage\\Site-centre-formation\\backend\\server.jsserapi.js','                                                                                              '
  ]
}
[nodemon] app crashed - waiting for file changes before starting...

on frontend folder: $ npm start

[email protected] start react-scripts start

'react-scripts' n’est pas reconnu en tant que commande interne ou externe, un programme exécutable ou un fichier de commandes.

Any idea? thanks for your answer.

I've tried an 'npm install' onn the front folder, but it doesn't works:

$ cd formation-frontend/

alexia.borelvaéhotma@AlexiaMac8 MINGW64 ~/Desktop/stage/Site-centre-formation/formation-frontend (main) $ npm install npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: [email protected] npm ERR! Found: [email protected] npm ERR! node_modules/react npm ERR! react@"^17.0.2" from the root project npm ERR! peer react@"^16.8.0 || ^17.0.0-rc.1" from @react-aria/[email protected] npm ERR! node_modules/@react-aria/ssr npm ERR! @react-aria/ssr@"^3.0.1" from @restart/[email protected] npm ERR! node_modules/@restart/ui npm ERR! @restart/ui@"^0.2.5" from [email protected] npm ERR! node_modules/react-bootstrap npm ERR! react-bootstrap@"^2.0.3" from the root project npm ERR! 21 more (@restart/hooks, @restart/ui, @testing-library/react, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer react@"^15.0.0 || ^16.0.0" from [email protected] npm ERR! node_modules/react-typical npm ERR! react-typical@"^0.1.3" from the root project npm ERR! npm ERR! Conflicting peer dependency: [email protected] npm ERR! node_modules/react npm ERR! peer react@"^15.0.0 || ^16.0.0" from [email protected] npm ERR! node_modules/react-typical npm ERR! react-typical@"^0.1.3" 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! npm ERR! For a full report see: npm ERR! C:\Users\alexia.borelvaéhotma\AppData\Local\npm-cache_logs\2022-11-21T09_06_44_713Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\alexia.borelvaéhotma\AppData\Local\npm-cache_logs\2022-11-21T09_06_44_713Z-debug-0.log

CodePudding user response:

the problem is that you've not dependencies for the current project, in your console go to the root directory of your project then type this.

    npm install
    npm start

CodePudding user response:

You need to install the dependencies first with npm install, since the dependencies normally won't be upload to GitHub. Then run rpm start again. Be aware the repository you run these commands matter as well.

  • Related