다음은 React 앱을 생성하기 위해 실행 한 명령과 결과 오류 로그입니다. 전에 명령을 사용하여 세 번 성공적으로 실행할 수 $ npx create-react-app
있었지만 이제는 실행할 때마다 작동하지 않고 대신 ES 모듈과 관련된 오류를 반환합니다. React를 Django와 통합하는 여러 가지 방법을 실험 해 왔지만 그렇게하면서 핵심 파일을 편집하면이 오류가 발생했을 것이라고 생각하지 않습니다. 저는 React와 Node.js를 완전히 처음 접했기 때문에 어떤 조언이라도 대단히 감사하겠습니다.
npx: installed 99 in 7.591s
Must use import to load ES Module: /Users/(username)/.npm/_npx/27993/lib/node_modules/create-react-app/node_modules/is-promise/index.js
require() of ES modules is not supported.
require() of /Users/(username)/.npm/_npx/27993/lib/node_modules/create-react-app/node_modules/is-promise/index.js from /Users/(username)/.npm/_npx/27993/lib/node_modules/create-react-app/node_modules/run-async/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename /Users/(username)/.npm/_npx/27993/lib/node_modules/create-react-app/node_modules/is-promise/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/(username)/.npm/_npx/27993/lib/node_modules/create-react-app/node_modules/is-promise/package.json.```
이것은 npm의 최근 문제인 것 같습니다. 지난 몇 시간 동안 열린 문제가 있으며 사람들이 문제를 해결하고있는 것 같습니다. Django / React 프로젝트와 관련이 없다고 생각합니다.
문제가 해결되는 동안 : 아래와 같이 노드 버전 12.12.0을 설치하고 create-react-app을 다시 실행하십시오.
nvm install 12.12.0
nvm use 12.12.0
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다