create-react-app 我无法创建React应用

fnx2tebb  于 22天前  发布在  React
关注(0)|答案(4)|浏览(14)
npx create-react-app my-app
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'C:\Users\User\.node_modules\node_modules\create-react-app\index.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v17.1.0
 Bryant 16:22 Mon   D:/t  1.68s 
🚀  npx create-react-app my-app

Creating a new React app in D:\t\my-app.

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

➤ YN0000: ┌ Resolution step
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0061: │ babel-eslint@npm:10.1.0 is deprecated: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
➤ YN0061: │ urix@npm:0.1.0 is deprecated: Please see https://github.com/lydell/urix#deprecated
➤ YN0061: │ resolve-url@npm:0.2.1 is deprecated: https://github.com/lydell/resolve-url#deprecated
➤ YN0061: │ querystring@npm:0.2.1 is deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
➤ YN0061: │ querystring@npm:0.2.0 is deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
➤ YN0061: │ flatten@npm:1.0.3 is deprecated: flatten is deprecated in favor of utility frameworks such as lodash.
➤ YN0061: │ chokidar@npm:2.1.8 is deprecated: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
➤ YN0061: │ fsevents@npm:1.2.13 is deprecated: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
➤ YN0061: │ uuid@npm:3.4.0 is deprecated: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
➤ YN0061: │ svgo@npm:1.3.2 is deprecated: This SVGO version is no longer supported. Upgrade to v2.x.x.
➤ YN0032: │ nan@npm:2.14.2: Implicit dependencies on node-gyp are discouraged
➤ YN0061: │ rollup-plugin-babel@npm:4.4.0 is deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
➤ YN0061: │ @hapi/joi@npm:15.1.1 is deprecated: Switch to 'npm install joi'
➤ YN0061: │ core-js@npm:2.6.12 is deprecated: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js 
versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
➤ YN0061: │ sane@npm:4.1.0 is deprecated: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
➤ YN0061: │ @hapi/bourne@npm:1.3.2 is deprecated: This version has been deprecated and is no longer supported or maintained
➤ YN0061: │ request@npm:2.88.2 is deprecated: request has been deprecated, see https://github.com/request/request/issues/3142
➤ YN0061: │ request-promise-native@npm:1.0.9 is deprecated: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
➤ YN0061: │ har-validator@npm:5.1.5 is deprecated: this library is no longer supported
➤ YN0061: │ @hapi/topo@npm:3.1.6 is deprecated: This version has been deprecated and is no longer supported or maintained
➤ YN0061: │ @hapi/address@npm:2.1.4 is deprecated: Moved to 'npm install @sideway/address'
➤ YN0061: │ @hapi/hoek@npm:8.5.1 is deprecated: This version has been deprecated and is no longer supported or maintained
➤ YN0032: │ evp_bytestokey@npm:1.0.3: Implicit dependencies on node-gyp are discouraged
➤ YN0002: │ react-dev-utils@npm:11.0.4 doesn't provide typescript (p79ddf), requested by fork-ts-checker-webpack-plugin
➤ YN0002: │ react-dev-utils@npm:11.0.4 doesn't provide webpack (p2af19), requested by fork-ts-checker-webpack-plugin
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 9s 124ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ @npmcli/move-file@npm:1.1.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @pmmmwh/react-refresh-webpack-plugin@npm:0.4.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @rollup/plugin-node-resolve@npm:7.1.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @rollup/plugin-replace@npm:2.4.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ @rollup/pluginutils@npm:3.1.0 can't be found in the cache and will be fetched from the remote registry   
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ aws-sign2@npm:0.7.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ aws4@npm:1.11.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ axe-core@npm:4.1.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ axobject-query@npm:2.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ babel-eslint@npm:10.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ babel-extract-comments@npm:1.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ core-util-is@npm:1.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ cosmiconfig@npm:5.2.1 can't be found in the cache and will be fetched from the remote registry 
➤ YN0013: │ cosmiconfig@npm:6.0.0 can't be found in the cache and will be fetched from the remote registry 
➤ YN0013: │ cosmiconfig@npm:7.0.0 can't be found in the cache and will be fetched from the remote registry 
➤ YN0013: │ cra-template@npm:1.1.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ domutils@npm:1.7.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ dot-case@npm:3.0.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ dot-prop@npm:5.3.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ dotenv-expand@npm:5.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ dotenv@npm:8.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ hmac-drbg@npm:1.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ hoopy@npm:0.1.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ hosted-git-info@npm:2.8.8 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ hpack.js@npm:2.1.6 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ hsl-regex@npm:1.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ parse-json@npm:2.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ parse-json@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ parse-json@npm:5.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ parse5@npm:5.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ parseurl@npm:1.3.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ path-exists@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ path-is-absolute@npm:1.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ path-is-inside@npm:1.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ path-key@npm:2.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ path-key@npm:3.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ strip-ansi@npm:3.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ strip-ansi@npm:5.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ strip-ansi@npm:6.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ strip-ansi@npm:6.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ strip-bom@npm:3.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0001: │ Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
    at new NodeError (node:internal/errors:371:5)
    at PassThrough.onclose (node:internal/streams/end-of-stream:122:30)
    at PassThrough.emit (node:events:390:28)
    at emitCloseNT (node:internal/streams/destroy:145:10)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
➤ YN0013: │ yargs-parser@npm:13.1.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs-parser@npm:18.1.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:13.3.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:15.4.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 8s 927ms
➤ YN0000: Failed with errors in 18s 56ms

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template --cwd D:\t\my-app has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.

到底出了什么问题?我卸载并重新安装了它,但仍然无法使用...啊啊啊啊啊,我的项目需要React。所以请帮帮我。

4ioopgfo

4ioopgfo1#

我也面临同样的问题。

kr98yfug

kr98yfug2#

为了解决这个问题(对我来说),请卸载并删除所有与node相关的文件。然后重新安装node,这样就可以正常工作了。我不知道是什么bug导致了这个问题。但是重新安装和重新安装可以解决问题。注意,如果你正在使用github桌面版,并且在发布仓库时遇到错误,请先卸载github桌面版以及之前用它创建的所有.git文件夹。然后重新安装它。这对我来说解决了问题。希望对你有所帮助。祝你好运。再见~

qq24tv8q

qq24tv8q3#

这是你的节点版本。我之前也遇到了同样的问题,但现在已经解决了。我相信你使用的是节点版本17,由于某些奇怪的原因它无法正常工作。卸载它并安装v16版本,这样应该就可以正常工作了。

xqk2d5yq

xqk2d5yq4#

这个问题已经被自动标记为过时,因为它没有任何最近的活动。如果没有发生任何进一步的活动,它将在5天后被关闭。

相关问题