简体   繁体   English

npm 错误! 代码 ENOTEMPTY npm 错误! 系统调用重命名

[英]npm ERR! code ENOTEMPTY npm ERR! syscall rename

when I try to initialize a react-native project I am getting this error.当我尝试初始化 react-native 项目时,我收到此错误。 Anyone know how to resolve this please help任何人都知道如何解决这个问题请帮助

i am using mac我正在使用 mac


Need to install the following packages:
  react-native
Ok to proceed? (y) y
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/react-native
npm ERR! dest /Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg
npm ERR! errno -66
npm ERR! ENOTEMPTY: directory not empty, rename '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/react-native' -> '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/codelanticdeveloper/.npm/_logs/2022-02-16T15_54_46_715Z-debug-0.log

I also had this problem and fixed it by:我也遇到了这个问题并通过以下方式解决了它:

  1. Deleting the problematic Expo files here per the instructions here I'm trying to reinstall expo-cli package globally with the command sudo npm install --g expo-cli note that I try --force按照此处的说明删除有问题的 Expo 文件,我正在尝试使用命令全局重新安装 expo-cli package sudo npm install --g expo
  2. In the terminal, running nvm install 16.14.0 (this will download the correct Node.js LTS release that is required by Expo)在终端中,运行nvm install 16.14.0 (这将下载 Expo 所需的正确 Node.js LTS 版本)
  3. In the terminal, running brew install watchman (this is required by Expo)在终端中,运行brew install watchman (这是 Expo 要求的)
  4. In the terminal, running npm install --global expo-cli (globally downloading Expo again)在终端中,运行npm install --global expo-cli (再次全局下载 Expo)
  5. In the terminal, running expo init my-app to finally create the new app successfully!在终端中运行expo init my-app终于成功创建新应用了!

where it says...它在哪里说...

directory not empty, rename '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/react-native' -> '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'目录不为空,重命名 '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/react-native' -> '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'

delete the file after the arrow and try again删除箭头后的文件,然后重试

rm -rf '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg' rm -rf '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'

Try deleting all the files in the node modules that end with a similar names, like '*-QIQKGFeg' I did it manually and it worked for me尝试删除节点模块中以相似名称结尾的所有文件,例如 '*-QIQKGFeg' 我手动完成的,它对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM