bestsource

템플릿이 create-react-app을 사용하여 제공되지 않음

bestsource 2023. 2. 9. 22:02
반응형

템플릿이 create-react-app을 사용하여 제공되지 않음

「 」를 create-react-app my-app모든 라이브러리를 정상적으로 다운로드하는 등 터미널에서 명령어가 동작하는 것 같습니다.그러나 이 프로세스의 마지막에 다음과 같은 메시지가 나타납니다.template was not provided.

입력

user@users-MacBook-Pro-2 Desktop% create-react-app my-app

산출량

Creating a new React app in /Users/user/Desktop/my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
..... nothing out of the ordinary here .....
✨  Done in 27.28s.

A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.

大名의 大名.my-app:

"dependencies": {
  "react": "^16.12.0",
  "react-dom": "^16.12.0",
  "react-scripts": "3.3.0" <-- up-to-date
}

CRA changelog를 확인해보니 커스텀템플릿 지원이 추가된 것 같습니다만, 명령어는 아닌 것 같습니다.create-react-app my-app바뀌었을 거야

여기서 무슨 일이 일어나고 있는지 아는가?

」를 인스톨 하고 는, 「 」create-react-app를 하여 글로벌하게npm install -g create-react-app 「 」를 를 언인스톨 을 추천합니다.npm uninstall -g create-react-app 확실하게 npx는 항상 최신 버전을 사용합니다.

문서

다음 명령어 중 하나를 사용합니다.

  • npx create-react-app my-app
  • npm init react-app my-app
  • yarn create react-app my-app

상기의 경우는 동작하지 않습니다.유형which create-react-app설치 장소를 알 수 있습니다.내 것은 에 설치되었다./usr/bin주세요.sudo rm -rf /usr/bin/create-react-app (의 @ 코멘트 크레딧) (@v42 코멘트)

1)

npm uninstall -g create-react-app

또는

yarn global remove create-react-app

2)

create-react-app이 제대로 제거되지 않아 새로운 명령어 중 하나를 사용하면 다음과 같은 오류가 발생할 수 있습니다.

템플릿이 제공되지 않았습니다.오래된 버전의 create-react-app을 사용하고 있기 때문일 수 있습니다.

「」로 한 후.npm uninstall -g create-react-app되어 which create-react-app(Windows:where create-react-app를 참조해 주세요.반환되는 것이 있으면(예: /usr/local/bin/create-react-app)rm -rf /usr/local/bin/create-react-app수동으로 삭제합니다.

3)

다음으로 다음 중 하나의 방법을 제시하겠습니다.

npx create-react-app my-app
npm init react-app my-app
yarn create react-app my-app

이미 많은 답이 여기 있지만.저는 이 상황에 직면했을 때 차근차근 적용했던 3가지 해결책을 생각해냈습니다.


첫 번째 단계:공식 매뉴얼에서,

create-react-app을 통해 설치한npm install -g create-react-app 「 」를 를 언인스톨 을 추천합니다.npm uninstall -g create-react-app가 항상 버전을 .npx는 최신 버전을 사용합니다.

https://create-create-contrace-app.dev/contrace/getting

다음 명령을 사용할 수 있습니다.

  • npx create-react-app my-app
  • npm init react-app my-app
  • yarn create react-app my-app

번째 단계(첫 번째 단계가 작동하지 않는 경우):

캐시를 유지할 수 있습니다.그런 다음 다음 다음 명령을 사용할 수 있습니다.

  • npm uninstall -g create-react-app
  • npm cache clean --force
  • npm cache verify
  • yarn create react-app my-app

번째 순서: (이러한 2개가 동작하지 않는 경우)를 경유하여 먼저 언인스톨 하고, 커맨드 라인에 커맨드를 붙여 아직 「installed」하고 있는 것을 확인합니다.(/usr/local/bin/create-react-app)과 같은 항목이 있는 경우 이(폴더는 다를 수 있음)를 실행하여 수동으로 삭제합니다.그런 다음 npx/npm/yarn을 통해 다시 설치합니다.

마지막 단계에서 성공했습니다.

먼저 다음 명령을 사용하여 create-react-app을 글로벌하게 제거합니다.

npm uninstall -g create-react-app

프로젝트 디렉토리에서 다음을 수행합니다.

npm install create-react-app@latest

마지막으로:

npx create-react-app my-app

위의 답변을 더하려면:

create-react-app커스텀 템플릿을 사용하여 새로운 앱을 만들 수 있습니다.현재 사용할 수 있는 템플릿은 다음 두 가지입니다.

  • 크래프론트
  • cra-class-typescript

사용방법:

npx create-react-app my-app [--template typescript]

의 내용은 를 참조하십시오.create-react-app:

https://github.com/facebook/create-react-app/releases/tag/v3.3.0

★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★npm init react-app my-app는 같은 했습니다.

템플릿이 제공되지 않았습니다.오래된 버전의 create-react-app을 사용하고 있기 때문일 수 있습니다.

그렇지만

yarn create react-app my-app명령어는 정상적으로 동작합니다.

먼저 npm 캐시를 클리어한 후 다음과 같이 실을 사용합니다.

  • npm cache clean --force
  • npm cache verify
  • yarn create react-app my-app

이게 도움이 됐으면 좋겠어요.

편집

...이 문제에 대해 좀 더 조사한 후에 다음 사항을 시도해 보는 것이 좋습니다.

  1. npm uninstall -g create-react-app
  2. yarn global remove create-react-app
  3. which create-react-app - /usr/local/bin/create-react-app 등의 반환이 있을 경우 rm -rf /usr/local/bin/create-react-app을 실행하여 수동으로 삭제합니다.
  4. npm cache clean --force
  5. npm cache verify
  6. npx create-react-app@latest

이 단계에서는 글로벌하게 설치된 create-react-app 설치를 제거한 다음 글로벌하게 설치된 이전 create-react-app 스크립트에 연결된 이전 디렉토리를 수동으로 제거합니다.그런 다음 create-react-app의 오래된 캐시 버전을 사용하지 않도록 npm 캐시를 지우는 것이 좋습니다.마지막으로 다음과 같은 옵션을 사용하여 새로운 reactjs 앱을 만듭니다.npx create-react-app을 사용할 때 템플릿이 생성되지 않는 이 문제에 대해 많은 혼란이 있었습니다.상기 (1-6)의 순서에 따라 주시면 성공하시기를 바랍니다.

추신.

그런 다음 클라이언트라는 디렉터리에 리액트 앱을 만들려면 단말기에 다음 명령을 입력합니다.

npx create-react-app@latest ./client

행운을 빌어요.

  1. npm install -g create-react-app에 접속합니다.
  2. npx create-react-app my-app

이건 나한테 효과가 있었어.

  1. npm uninstall -g create-react-app
  2. npx create-react-app my-app

여기 모든 단계를 거쳤지만 도움이 안 됐어요

TLDR 실행, TLDR 실행npx --ignore-existing create-react-app

는 맥을 있다.Mojave 10.15.2

글로벌하게 .CRA에 CRA에 없습니다./usr/local/lib/node_modules ★★★★★★★★★★★★★★★★★」/usr/local/bin어느 하나.

그러다 우연히 CRA의 기트허브 문제에 대한 의견을 접하게 되었습니다.에서 명령어를 실행하다--ignore-existing깃발이 도움이 되었다.

이 두 단계는 나에게 효과가 있었다.

1) 이 명령어를 사용하여 글로벌하게 react-app 제거

npm uninstall -g create-react-app

2) 이 명령어로 react-app을 프로젝트 폴더에 설치

npx create-react-app project-name

npx create-react-app@latest your-project-name

앞으로 누군가에게 도움이 될 수 있는 모든 답을 시도해 보고 저를 위해 일하세요.

npm install -g create-react-app을 통해 create-react-app을 글로벌하게 설치한 경우 npm uninstall -g create-react-app을 사용하여 패키지를 제거하여 npx가 항상 최신 버전을 사용하도록 하는 것이 좋습니다.

이것은 https://create-react-app.dev/docs/getting-started/보고됩니다.나에게는, 이것은 통하지 않았다.대신 create-react-app을 글로벌하게 재설치해야 했습니다.

이 문제를 해결하기 위한 절차는 다음과 같습니다.

  1. npm uninstall - g create-display-app
  2. npm install -g create-create-module-app
  3. npx create-my-app my-app

MacOS에서는 모든 옵션이 작동하지 않았습니다.동작하는 것은, 다음의 3개의 순서입니다.

  1. 노드를 삭제합니다. /usr/local/bin/

그리고나서

  1. 새로 설치 노드: https://nodejs.org/en/

그리고나서

  1. install react:npx create-react-app my-app 다음 https://create-react-app.dev/

Linux에서는 이 방법이 효과적이었다.

sudo npm uninstall -g create-react-app
npx create-react-app my-test-app

TLDR을 사용하여 를 언인스톨 .npm uninstall -g create-react-app할 수 있습니다.npx create-react-app app.


쟁점.

버전을 create-react-appnpm을 사용하여 했습니다.create-react-app명령어는 이 글로벌패키지를 호출합니다.

수 .npm outdated -g create-react-appcreate-react-app --versionnpm view create-react-app.

react-scripts과는 관계가 (이 버전에는 가 없습니다).create-react-app 패키지의 최신 ( 「 」 )을 react-scripts(어느 쪽인가)

솔루션

를 계속 create-react-app를 업데이트해야 npm update -g create-react-app이 작업을 정기적으로 수행하여 최신 상태를 유지해야 합니다. 게 거예요.create-react-app는 이것을 권장하지 않습니다(설치 로그에 기록).

삭제하는 것이 ( 「 」 「 」 「 」 「 」 「 」 「 」 「 」 「 。npm uninstall -g create-react-app 해서 대신 을 사용하세요.npx할 수 내용은 를 참조하십시오).npx이하에 나타냅니다).

되어 있는 .create-react-app찾을 수 없다

언인스톨에 관한 문제

, 인스톨 해 주세요.which create-react-app에 복수의 버전의 가 있는 경우가 인스톨로부터, 노드 하고 있기 에).「 」, 「 」, 「 」, 「 」, 「 」, 「/npm」의 노드 매니저를 사용하고 있기 때문입니다.nvm이 문제는 여기서 다루지 않겠습니다만, 이 답변에는 몇 가지 정보가 포함되어 있습니다.

빠른 핵접근은 강제로 제거하는 것이다.rm -rf)이(가) 「」을(를) 취득한 which create-react-app아온온다


보충.

및 "npm"npx

$ NPM_PACKAGE_NAME 어느 있는지에 되고 있는 합니다.

$ npx NPM_PACKAGE_NAME에서 루트로했을 때 의 첫 합니다.

  • 현재의 디렉토리에 패키지가 있는 경우는, 그것을 사용합니다.
  • 그렇지 않으면 현재 디렉토리의 상위 디렉토리에 패키지가 있는 경우 처음 발견된 디렉토리가 사용됩니다.
  • 그렇지 않으면 패키지가 글로벌하게 설치되어 있는 경우 해당 패키지가 사용됩니다.
  • 패키지가 없는 경우 패키지가 일시적으로 설치되고 사용 후 폐기됩니다.이것이 패키지를 최신 상태로 유지하는 가장 좋은 방법입니다.

npx에 대한 자세한 내용은 이 답변에서 확인할 수 있습니다.

「」를 사용합니다.npxcreate-react-app

create-react-app 몇 가지 명령어 은 리액트앱을 작성하기 위한 명령어 또는 명령어입니다).npx 패키지에 「」를 참조해 주세요).yarn create react-app,npm init react-app단, 단,npx create-react-app이치하다

yarn »npm 설치

를 Yarn과 다른 합니다.npm 「」라고 하는 것이 됩니다.yarn create react-app글로벌 npm 패키지를 언인스톨 하지 않아도, 곧바로 동작합니다(실에서는 패키지가 인스톨 되어 있지 않습니다).

Create React App을 사용할 때는 항상 npm 대신 실을 사용해야 하기 때문에 이것은 일시적인 해결책일 뿐입니다.

이거면 돼!

1)npm uninstall -g create-react-app

2)npm install -g create-react-app

3)npx create-react-app app_name

인스톨 되어 있는 「」가 .create-react-app를 하여 글로벌하게npm install -g create-react-app를 사용하여 제거하는 npm uninstall -g create-react-app

이것으로 문제가 해결되었다

순서:

1. Create-React 앱 언인스톨

npm uninstall -g create-react-app

2. 이제 사용만 하면 됩니다.

npx create-react-app my-app

그러면 u용 템플릿이 자동으로 생성됩니다.

이 문제는 이렇게 해결되지 않습니다.문제는 노드의 다른 인스턴스에서 발생합니다.글로벌하게 create-react-app을 삭제하고 node_modules와 package-lock.json을 루트 사용자로부터 삭제합니다.

이 일은 나를 위한 것이다.

다음 명령을 사용하여 create-react-app을 글로벌하게 제거합니다.

npm uninstall -g create-react-app

그 후 프로젝트 디렉토리에서 다음을 수행합니다.

npm install create-react-app@latest

마지막으로:

npx create-react-app my-app

타이프 스크립트의 경우:

npx create-react-app my-app --template typescript

먼저 create-react-app을 제거합니다.

npm uninstall -g create-react-app

다음 " " " " 를 실행합니다.yarn create react-app my-app ★★★★★★★★★★★★★★★★★」npx create-react-app my-app

후 실행 중yarn create react-app my-app ★★★★★★★★★★★★★★★★★」npx create-react-app my-app가 날 수 .

템플릿이 제공되지 않았습니다.오래된 버전의 create-react-app을 사용하고 있기 때문일 수 있습니다.create-react-app 글로벌 설치는 더 이상 지원되지 않습니다.

이 문제는 캐시 때문에 발생할 수 있습니다.그래서 다음 실행은

npm cache clean --force 

그 후 실행

npm cache verify

이제 다 해결됐어.지금 실행

yarn create react-app my-app ★★★★★★★★★★★★★★★★★」npx create-react-app my-app

이제 기대했던 것을 얻을 수 있습니다!

Mac에서 이 문제를 해결하려면create-react-app npm lib에서는 global npm lib도 합니다.냥냥해해 해다다다다다당신도 할 필요가 있어요.sudo:

sudo npm uninstall -g create-react-app

다음으로 실행만 하면 됩니다.

npx create-react-app my-app-name

이제 모든 것이 정상이며 다음과 같이 폴더 구조를 가져옵니다.

Create react 앱을 사용하여 템플릿이 제공되지 않음

사용npm uninstall -g create-react-app나한테는 통하지 않았어

하지만 이것은 효과가 있었다.

yarn global remove create-react-app

그 후:

npx create-react-app my-app

어제도 이 문제가 잘 풀렸고 오늘 아침에도 같은 오류가 발생했기 때문에 이런 이상한 문제가 발생했어요.으로 지원 " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " ( " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " "--typescript를 사용하기 위해 권장되지 않았습니다.--template typescript)

다음 작업을 통해 모든 작업을 수행할 수 있었습니다.

  1. create-react-app을 합니다.create-react-app 。npm uninstall create-react-app -g.
  2. 캐시 npm 확인npm cache verify.
  3. 단말기를 닫습니다.Mac 터미널을 사용하고 있는데 IDE를 사용하면 닫았다가 다시 열 수 있습니다.
  4. 터미널을 다시 열고 프로젝트를 원하는 위치로 이동한 후 새 템플릿 명령 규칙을 사용하여 npx를 통해 create-react-app을 실행합니다. 문서 했습니다.「 my - app 」 。npx create-react-app my-app --template typescript

동작하는 경우는, 리액트 스크립트용의 인스톨과 템플릿용의 인스톨이 복수 표시됩니다.에러 메세지도 표시되지 않게 됩니다.

npm uninstall -g create-react-app어떤 경우에는 해답이 될 수 있지만 내 경우에는 그렇지 않아

create-react-app은 .~/.node/bin/ ★★★★★★★★★★★★★★★★★」/usr/bin/ 입력해 주세요).which create-react-app를 사용하여 본 합니다.rm -rf), 다음 실행만 하면 됩니다.npm i -g create-react-app.

후 ★★★create-react-app정상적으로 동작합니다.

나 이거 1번 성공했어.먼저 다음 명령을 사용하여 create-react-app을 글로벌하게 제거합니다.

npm uninstall -g create-react-app

이전 설치가 남아 있다면 my app이라는 폴더를 완전히 삭제해 주세요.(단말기 또는 cmd 프롬트를 포함하여 해당 폴더를 사용하는 프로그램이 없는지 확인하십시오.)

2. 프로젝트 디렉토리에서 다음을 수행합니다.

npm install create-react-app@latest

3.120:

npx create-react-app my-app

이 문제를 안고 있는 Windows 유저의 경우는, 다음과 같이 수정했습니다.

  1. 실행합니다.where create-react-app(C:\Local\Users\username\AppData\Local\§\bin)
  2. 해당 디렉토리로 이동하여 "create-react-app" 및 "create-react-app.cmd"를 모두 삭제합니다.
  3. 프로젝트를 시작할 디렉토리로 이동하십시오.
  4. 실행합니다.npm install create-react-app,npx create-react-app name-of-app,cd name-of-app,yarn start.

스텝 #4는 구성에 따라 다르지만, 이것이 바로 가동의 원동력이 되었습니다.

가장 쉬운 방법 중 하나는 다음을 사용하는 것입니다.

npx --ignore-existing create-react-app [project name]

캐시된 이전 버전의 create-react-app을 제거한 후 새 버전을 가져와 프로젝트를 만듭니다.

주의: 기존 create-react-app 버전을 무시하는 것만으로 프로젝트 이름을 추가하는 것이 중요합니다.또한 머신의 글로벌 환경 변경은 일시적이기 때문에 나중에 를 사용하기만 하면 됩니다.npx create-react-app [project name]을 사용법

npx create-react-app@latest {project name}

이렇게 하는 것 같아요.

다음 명령어 사용 후:

yarn global upgrade create-react-app

그리고 나서 시도했다:

yarn create-react-app my-app but it didn't work for me.

이 방법은 효과가 있었습니다.

npx create-react-app my-app 

언급URL : https://stackoverflow.com/questions/59188624/template-not-provided-using-create-react-app

반응형