У меня проблема с попыткой создать реагирующее приложение - Ошибка: не удается найти модуль './gitignore' - PullRequest
0 голосов
/ 13 апреля 2020

Я windows пользователь, у меня git, узел и пряжа установлены. Какие необходимы для создания моего приложения React, и я получаю сообщение об ошибке, которое прерывает установку. Можете ли вы сказать мне, как решить эту проблему, потому что я установил и удалил узел и git, какой из двух, по моему мнению, вызывает проблемы или отсутствует папки?

PS C:\React> npx create-react-app my-app

Creating a new React app in C:\React\my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.12: The platform "win32" is incompatible with this module.
info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.2: The platform "win32" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "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".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 13 new dependencies.
info Direct dependencies
├─ cra-template@1.0.3
├─ react-dom@16.13.1
├─ react-scripts@3.4.1
└─ react@16.13.1
info All dependencies
├─ @babel/plugin-transform-flow-strip-types@7.9.0
├─ @babel/plugin-transform-runtime@7.9.0
├─ @babel/plugin-transform-typescript@7.9.4
├─ @babel/preset-typescript@7.9.0
├─ babel-preset-react-app@9.1.2
├─ cra-template@1.0.3
├─ eslint-config-react-app@5.2.1
├─ react-dev-utils@10.2.1
├─ react-dom@16.13.1
├─ react-error-overlay@6.0.7
├─ react-scripts@3.4.1
├─ react@16.13.1
└─ scheduler@0.19.1
Done in 34.13s.
internal/modules/cjs/loader.js:983
  throw err;
  ^

Error: Cannot find module './gitignore'
Require stack:
- C:\React\my-app\node_modules\globby\index.js
- C:\React\my-app\node_modules\react-dev-utils\globby.js
- C:\React\my-app\node_modules\react-scripts\scripts\utils\verifyTypeScriptSetup.js
- C:\React\my-app\node_modules\react-scripts\scripts\init.js
- C:\React\my-app\[eval]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\React\my-app\node_modules\globby\index.js:6:19)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1042:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\React\\my-app\\node_modules\\globby\\index.js',
    'C:\\React\\my-app\\node_modules\\react-dev-utils\\globby.js',
    'C:\\React\\my-app\\node_modules\\react-scripts\\scripts\\utils\\verifyTypeScriptSetup.js',
    'C:\\React\\my-app\\node_modules\\react-scripts\\scripts\\init.js',
    'C:\\React\\my-app\\[eval]'
  ]
}

Aborting installation.
  node  has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting my-app/ from C:\React
Done.
PS C:\React>

Ответы [ 2 ]

0 голосов
/ 13 апреля 2020

Возможно, вы захотите попробовать предложения из этого поста: Реагировать: создание-реакция-приложение завершается с ошибкой «Не удается найти модуль« lodash »» .

То есть выполните:

npm cache clean --force 
npm i 
npm i -g create-react-app 

А затем повторите команду:

npx create-react-app my-app
0 голосов
/ 13 апреля 2020

Убедитесь, что вы не пытаетесь случайно импортировать gitignore в ваш проект. Выполните поиск по всем файлам кода.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...