“固定”;找不到模块';libnpx'&引用;关于react-native-init

“固定”;找不到模块';libnpx'&引用;关于react-native-init,react-native,cocoapods,React Native,Cocoapods,对于新项目,在运行react native init{project}之后, 在“安装所需Cocoapods依赖项”阶段,会引发以下错误: Error: Cannot find module 'libnpx' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15) at Function.Module._load (internal/modules/cjs/loader.js:575:

对于新项目,在运行
react native init{project}
之后, 在“安装所需Cocoapods依赖项”阶段,会引发以下错误:

Error: Cannot find module 'libnpx'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15)
    at Function.Module._load (internal/modules/cjs/loader.js:575:25)
    at Module.require (internal/modules/cjs/loader.js:705:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npx-cli.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:799:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
    at Module.load (internal/modules/cjs/loader.js:666:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
    at Function.Module._load (internal/modules/cjs/loader.js:598:3)

(node:27038) UnhandledPromiseRejectionWarning: Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./RNimage/ios && pod install".
我甚至还没有接触过这个项目,为什么会发生这种情况,我该如何修复它


在此之前,我运行了
sudo chown-R 501:20”/Users/vorousjames/.npm“
。我不知道这对这个问题是否重要,但它已经破坏了很多。

usr/local/bin
中删除了节点和npm文件,然后重新安装了节点LTS版本。npm命令现在可以工作了

对于上述问题,无需删除任何文件。 因此,要解决此问题,只需从以下位置安装节点:

[!] Invalid 'Podfile' file 767: unexpected token at ''. 
 #  from /Users/.../Desktop/Development/RNproject/ios/Podfile:42
 #  -------------------------------------------
 #  
 >    use_native_modules!
 #  end
 #  -------------------------------------------