当我尝试初始化一个react-native项目时,我得到了这个错误。有谁知道如何解决这个问题,请帮助
我用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
3条答案
按热度按时间tez616oj1#
上面写着
目录不是空的,重命名'/Users/codelanticdeveloper/.npm/_npx/7930 a8670 f922 cdb/node_modules/react-native' -> '/Users/codelanticdeveloper/.npm/_npx/7930 a8670 f922 cdb/node_modules/.react-native-QIQKGFeg'
删除箭头后的文件并重试
rm -rf '/Users/codelanticdeveloper/.npm/_npx/7930a8670f922cdb/node_modules/.react-native-QIQKGFeg'
41zrol4v2#
尝试删除节点模块中以类似名称结尾的所有文件,如'*-QIQKGFeg'我手动操作,它对我有效
umuewwlo3#
我也遇到了这个问题,并通过以下方式解决了它:
1.按照此处的说明删除此处有问题的Expo文件I'm trying to reinstall expo-cli package globally with the command sudo npm install --g expo-cli note that I try --force
1.在终端中,运行
nvm install 16.14.0
(这将下载Expo所需的正确Node.js LTS版本)1.在终端运行
brew install watchman
(这是Expo要求的)1.在终端运行
npm install --global expo-cli
(再次全局下载Expo)1.在终端中运行
expo init my-app
,最终成功创建新应用!