简体   繁体   中英

After running npm start in react application I have this error: internal/modules/cjs/loader.js:834

I downloaded my course react project, get into it, install dependencies and tried to run npm start. I got this nasty error:

PS C:\Users\Marcin & Joanna\Desktop\react-frontend-01-starting-setup> npm start

> frontend@0.1.0 start C:\Users\Marcin & Joanna\Desktop\react-frontend-01-starting-setup
> react-scripts start

'Joanna\Desktop\react-frontend-01-starting-setup\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:834
  throw err;
  ^

Error: Cannot find module 'C:\Users\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! frontend@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@0.1.0 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\Marcin & Joanna\AppData\Roaming\npm-cache\_logs\2020-10-23T07_19_44_441Z-debug.log
PS C:\Users\Marcin & Joanna\Desktop\react-frontend-01-starting-setup>

I tried with others project, same results. I tried to run npx-create-react-app my-app with no success, I got this error:

PS C:\Users\Marcin & Joanna\Desktop\mernStack> npx create-react-app frontend
Error: EPERM: operation not permitted, mkdir 'C:\Users\Marcin'
System nie może odnaleźć określonej ścieżki.
Instalacja [ 'create-react-app@latest' ] nie udała się, kod błędu: 1
PS C:\Users\Marcin & Joanna\Desktop\mernStack> 

Those lines in Polish simply say:

System can not find specified path.

Installation [ 'create-react-app@latest' ]failed, error code 1.

I recently upgraded Node to version 14 and since then I got this issue. It doesn't matter which node version I install, I still got the same errors.

Remove & from the project path in: \\ Marcin & Joanna

It is better to change the saved path of the project

did you try in the project directory:

npm install

or

npx autofix

or try to create your app in a different directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM