Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Cannot Start Project - 'craco' is not recognized as an internal or external command

is anyone able to tell me why I cannot start up my website project on the development server?

I've cloned a file on Windows 10, this used to work fine on my Mac OS ... before it died :'(Feel free to try the project: https://github.com/EMDevelop/j2c

When I run npm start, I get the following message

> [email protected] start C:\Users\Ed\Desktop\Coding\React\j2c
> craco start

'craco' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `craco 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\Ed\AppData\Roaming\npm-cache\_logs\2021-03-26T16_11_19_513Z-debug.log

This is strange because I have "craco": "0.0.3" as a dependency, and "start": "craco start" as a script within my package.json.

I also have the craco.config file within the project, and @craco folder in the node_modules folder.

When I then try and install craco again (npm i @craco/craco) and run npm start, i get the below error asking me to install the dependencies:

C:\Users\Ed\Desktop\Coding\React\j2c>npm i @craco/craco
npm WARN [email protected] requires a peer of popper.js@^1.16.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^16.5.2 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native-vector-icons@>7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native-safe-area-context@^3.1.9 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-dom@^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^16.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@^16.11.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

npm ERR! code EEXIST
npm ERR! path C:\Users\Ed\Desktop\Coding\React\j2c\node_modules\.bin\craco
npm ERR! Refusing to delete C:\Users\Ed\Desktop\Coding\React\j2c\node_modules\.bin\craco: is outside C:\Users\Ed\Desktop\Coding\React\j2c\node_modules\@craco\craco and not a link
npm ERR! File exists: C:\Users\Ed\Desktop\Coding\React\j2c\node_modules\.bin\craco
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Ed\AppData\Roaming\npm-cache\_logs\2021-03-26T16_29_51_457Z-debug.log

This is strange also because I have most of these dependencies inside of the node_modules folder (and package.json):

Packages.Json Screenshot

I'm concerned about just recklessly forcing craco to replace the old version, and will I then have to do that for every dependency it has given me the warning for? most of which dependencies already exist.

Then when I try and run npm start again, it gives me the error as if I never had craco installed again:

C:\Users\Ed\Desktop\Coding\React\j2c>npm start

> [email protected] start C:\Users\Ed\Desktop\Coding\React\j2c
> craco start

'craco' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `craco 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\Ed\AppData\Roaming\npm-cache\_logs\2021-03-26T16_30_25_218Z-debug.log

Any help would be greatly appreciated!! pulling my hair out, I'm new to Windows.

like image 845
sudo install Avatar asked Dec 02 '22 09:12

sudo install


1 Answers

This worked for me

npm install @craco/craco --save
like image 188
Nuru Avatar answered Jan 12 '23 00:01

Nuru