npm ERR! enoent ENOENT: no such file or directory, rename 'E:\my_personcenter\PersonCenter_three\node_modules\npm\node_modules\dezalgo' -> 'E:\my_personcenter\PersonCenter_three\node_modules\npm\node_module s.dezalgo.DELETE' npm ERR! enoent This is related to npm not being able to find a file.
找不到文件错误,查询多次发现是npm版本的问题,导致这个问题以及一些包无法安装,比如出现如下的错误
error: bundling: UnableToResolveError: Unable to resolve module prop-types
from E:\my_personcenter\PersonCenter_three\src\common\react-native-swiper.js
: Module does not exist in the module map or in the
se directories:
E:\my_personcenter\PersonCenter_three\node_modules
This might be related to https://github.com/facebook/react-native/issues/4968 To resolve try the following:
- Clear watchman watches:
watchman watch-del-all
. - Delete the
node_modules
folder:rm -rf node_modules && npm install
. - Reset packager cache:
rm -fr $TMPDIR/react-*
ornpm start --reset-cache
. at UnableToResolveError (E:/my_personcenter/PersonCenter_three/node_modules/react-native/packager/src/node-haste/DependencyGraph/ResolutionRequest.js:488:5) at p.catch.error (E:/my_personcenter/PersonCenter_three/node_modules/react-native/packager/src/node-haste/DependencyGraph/ResolutionRequest.js:366:19) at process._tickCallback (internal/process/next_tick.js:109:7)
官网给出的解释是把全局的npm,但是是linux的命令,Windows不能用,模块需要全部删除重新安装。 在我的项目里,是因为全局的npm是5.6.0,而项目中依赖的是4.3.0,导致如上错误。 "dependencies": { "install": "0.8.9", "npm": "5.6.0", "prop-types": "^15.6.0", "react": "16.0.0-alpha.6", "react-native": "0.43.0", "react-native-fetch-blob": "0.10.5", "react-native-img-cache": "1.3.1", "react-native-scrollable-tab-view": "0.6.3", "react-native-vector-icons": "4.0.0", "react-timer-mixin": "0.13.3" }, 把dependencies中npm的版本和全局版本保持一致即可解决。