如何使用NPM安装React?

hivapdat  于 2023-02-13  发布在  React
关注(0)|答案(2)|浏览(171)

由于某种原因,我无法使用npm安装react,我不知道是什么问题。有人知道这个问题的解决方案吗?我卸载了npm,然后再试了一次,但没有帮助,并尝试了其他事情。但它没有帮助我。

stalling react, react-dom, and react-scripts with cra-template...

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\darslar\imtihon-app\node_modules\tailwindcss\oxide-node-api-shim/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\darslar\imtihon-app\node_modules\tailwindcss\oxide-node-api-shim\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\User\AppData\Local\npm-cache\_logs\2023-02-08T15_57_28_764Z-debug-0.log

Aborting installation.
  npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

Deleting generated file... package.json
node:fs:1226
  return handleErrorFromBinding(ctx);
         ^

Error: EBUSY: resource busy or locked, rmdir '\\?\D:\darslar\imtihon-app'
    at rmdirSync (node:fs:1226:10)
    at _rmdirSync (node:internal/fs/rimraf:235:5)
    at rimrafSync (node:internal/fs/rimraf:193:7)
    at Object.rmSync (node:fs:1275:10)
    at Object.removeSync (C:\Users\User\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\fs-extra\lib\remove\index.js:15:28)
    at C:\Users\User\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js:539:14
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -4082,
  syscall: 'rmdir',
  code: 'EBUSY',
}

Node.js v18.12.0
j2cgzkjk

j2cgzkjk1#

请尝试以下步骤:

  • 删除package-lock.json并再次运行NPM。
  • 确保node.js没有其他进程正在运行(检查任务管理器)
  • 如果您使用的是visual studio代码,请关闭它,然后再次尝试运行npm install。

您也可以查看以下问题页面:https://github.com/npm/npm/issues/17444

3bygqnnd

3bygqnnd2#

https://github.com/tailwindlabs/tailwindcss/issues/10534#issuecomment-1422896616
基本上你需要更新npm到最新版本

npm install -g npm@latest

删除package-lock.json和node_modules并启动

npm i

这是一个依赖性的问题。整个世界不能安装一个小时的React。

相关问题