npm run build & npm start not working, react app

2.8k Views Asked by At

I am a new react student, have no place else to ask this question and can't solve it on my own because I'm really confused, I don't even know how to put this question together properly. I'm following the instructions from a react course.

I installed node.js, created a new project folder, then in the terminal I wrote create react-app . everything worked, and then wrote npm run build and npm start, but both didn't work.

Heres the error messages for npm run build:

> [email protected] build C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder
> react-scripts build

"Courses\github-finder\node_modules\.bin\" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
internal/modules/cjs/loader.js:834
  throw err;
  ^

Error: Cannot find module 'C:\Users\liana\Documents\My stuff\Webdev\react-scripts\bin\react-scripts.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)   
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build 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\liana\AppData\Roaming\npm-cache\_logs\2020-10-18T02_07_40_371Z-debug.log
PS C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder> npm run build

> [email protected] build C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder
> react-scripts build

"Courses\github-finder\node_modules\.bin\" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
internal/modules/cjs/loader.js:834
  throw err;
  ^

Error: Cannot find module 'C:\Users\liana\Documents\My stuff\Webdev\react-scripts\bin\react-scripts.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)   
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build 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\liana\AppData\Roaming\npm-cache\_logs\2020-10-18T02_10_32_763Z-debug.log
PS C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder>

And heres the code for npm start

> [email protected] start C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder
> react-scripts start

"Courses\github-finder\node_modules\.bin\" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
internal/modules/cjs/loader.js:834
  throw err;
  ^

Error: Cannot find module 'C:\Users\liana\Documents\My stuff\Webdev\react-scripts\bin\react-scripts.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)   
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
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\liana\AppData\Roaming\npm-cache\_logs\2020-10-18T02_11_45_759Z-debug.log
PS C:\Users\liana\Documents\My stuff\Webdev\Practice Projects & Courses\github-finder>

some messages are in russian, if you need translation use the translator or ask me to leave the translation here, whatever you prefer

Thank you for reading this, I'm desperate and need help, nothing on the internet helped me just yet

2

There are 2 best solutions below

0
On BEST ANSWER

I found something that works. Using the command node node node_modules/react-scripts/scripts/start.js does the same thing as npm start, though I don't know what's the catch here. Works for me. Source: https://github.com/facebook/create-react-app/issues/8221

2
On

Firstly to create your project based on "create-react...." You have to use the exactly command "npx create-react-app 'yournameProject'" Then open your folder in a text editor like visual code and run the following command -> "npm start" It shouldnt give you error

About your problem: I think you have stepped something

So try to use first "npm i" then "npm start"