React无法启动项目-'craco'未被识别为内部或外部命令
谁能告诉我为什么我不能在开发服务器上启动我的网站项目?
我已经在 Windows 10 上克隆了一个文件,这曾经在我的 Mac OS 上运行良好......在它死之前:'(随意尝试该项目:https : //github.com/EMDevelop/j2c
当我运行时npm start,我收到以下消息
> just2connect@0.1.0 start C:UsersEdDesktopCodingReactj2c
> 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! just2connect@0.1.0 start: `craco start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the just2connect@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:UsersEdAppDataRoamingnpm-cache_logs2021-03-26T16_11_19_513Z-debug.log
这很奇怪,因为我有"craco": "0.0.3"一个依赖项,并且"start": "craco start"作为我的package.json.
我也有craco.config项目@craco中的node_modules文件和文件夹中的文件夹。
当我再次尝试安装 craco ( npm i @craco/craco) 并运行时npm start,出现以下错误,要求我安装依赖项:
C:UsersEdDesktopCodingReactj2c>npm i @craco/craco
npm WARN bootstrap@4.6.0 requires a peer of popper.js@^1.16.1 but none is installed. You must install peer dependencies yourself.
npm WARN radium@0.25.2 requires a peer of react@^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-coverflow@0.2.20 requires a peer of react@^16.5.2 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-elements@3.2.0 requires a peer of react-native-vector-icons@>7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-elements@3.2.0 requires a peer of react-native-safe-area-context@^3.1.9 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-ratings@7.3.0 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-size-matters@0.3.1 requires a peer of react-native@* but none is installed. You must install peer dependencies yourself.
npm WARN react-only-when@1.0.2 requires a peer of react@^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-only-when@1.0.2 requires a peer of react-dom@^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-particles-js@3.4.1 requires a peer of react@^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-swipeable@5.5.1 requires a peer of react@^16.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN react-testimonial@1.0.0 requires a peer of react@^16.11.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.20.0 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:UsersEdDesktopCodingReactj2cnode_modules.bincraco
npm ERR! Refusing to delete C:UsersEdDesktopCodingReactj2cnode_modules.bincraco: is outside C:UsersEdDesktopCodingReactj2cnode_modules@cracocraco and not a link
npm ERR! File exists: C:UsersEdDesktopCodingReactj2cnode_modules.bincraco
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:UsersEdAppDataRoamingnpm-cache_logs2021-03-26T16_29_51_457Z-debug.log
这也很奇怪,因为我在node_modules文件夹(和package.json)中有大部分这些依赖项:
我担心只是不顾后果地强迫 craco 替换旧版本,然后我是否必须对它给我警告的每个依赖项都这样做?其中大部分依赖项已经存在。
然后当我npm start再次尝试运行时,它给了我错误,就好像我从未再次安装过 craco:
C:UsersEdDesktopCodingReactj2c>npm start
> just2connect@0.1.0 start C:UsersEdDesktopCodingReactj2c
> 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! just2connect@0.1.0 start: `craco start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the just2connect@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:UsersEdAppDataRoamingnpm-cache_logs2021-03-26T16_30_25_218Z-debug.log
任何帮助将不胜感激!!拉我的头发,我是 Windows 的新手。
回答
这对我有用
npm install @craco/craco --save