为什么我运行react-native run-ios后会出现此错误?

时间:2019-01-01 19:55:57

标签: react-native-ios

我收到此错误

"Failed to load bundle(http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false) with error:(Unable to resolve module ./ cjs / react.production.min.js from /卷/ Macintosh 1TB /用户/nina/fyp/node_modules/react/index.js: The module./ cjs / react.production.min.js could not be found from /卷/ Macintosh 1TB /用户/nina/fyp/node_modules/react/index.js. Indeed, none of these files exist: */卷/ Macintosh 1TB /用户/ nina / fyp / node_modules / react / cjs / react.production.min.js(.native || .ios.js | .native.js | .js | .ios.json | .native.json | .json | .ios.ts |。 native.ts | .ts | .ios.tsx | .native.tsx | .tsx)* /卷/ Macintosh 1TB /用户/nina/fyp/node_modules/react/cjs/react.production.min.js /index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx | .native.tsx | .tsx)(null)) __38-[RCTCxxBridge loadSource:onProgress:]_block_invoke.248 RCTCxxBridge.mm:429 ___ZL36attemptAsynchronousLoadOfBundleAtURLP5NSURLU13block_pointerFvP18RCTLoadingProgressEU13block_pointerFvP7NSErrorP9RCTSourceE_block_invoke.118 __80-[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:]_block_invoke -[RCTMultipartStreamReader emitChunk:headers:callback:done:] -[RCTMultipartStreamReader readAllPartsWithCompletionCallback:progressCallback:] -[RCTMultipartDataTask URLSession:streamTask:didBecomeInputStream:outputStream:] __88-[NSURLSession delegate_streamTask:didBecomeInputStream:outputStream:completionHandler:]_block_invoke __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ -[NSBlockOperation main] -[__NSOperationInternal _start:] __NSOQSchedule_f _dispatch_call_block_and_release _dispatch_client_callout _dispatch_continuation_pop _dispatch_async_redirect_invoke _dispatch_root_queue_drain _dispatch_worker_thread2 _pthread_wqthread start_wqthread"

创建一个新项目(react-native init)后,我使用react-native run-ios运行模拟器,但显示错误。

this happens after i ran reset cache: "
events.js:173
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::8081
    at Server.setupListenHandle [as _listen2] (net.js:1255:14)
    at listenInCluster (net.js:1303:12)
    at Server.listen (net.js:1391:7)
    at /Volumes/Macintosh 1TB/Users/nina/fyp/node_modules/metro/src/enter code hereindex.js:193:18
    at new Promise (<anonymous>)
    at Object.<anonymous> (/Volumes/Macintosh 1TB/Users/nina/fyp/node_modules/metro/src/index.js:192:12)
    at Generator.next (<anonymous>)
    at step (/Volumes/Macintosh 1TB/Users/nina/fyp/node_modules/metro/src/index.js:50:30)
    at /Volumes/Macintosh 1TB/Users/nina/fyp/node_modules/metro/src/index.js:61:15
Emitted 'error' event at:
    at Server.WebSocketServer._onServerError (/Volumes/Macintosh 1TB/Users/nina/fyp/node_modules/ws/lib/WebSocketServer.js:82:50)
    at Server.emit (events.js:193:15)
    at emitErrorNT (net.js:1282:8)
    at process.internalTickCallback (internal/process/next_tick.js:72:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fyp@0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the fyp@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Volumes/Macintosh 1TB/Users/aimi/.npm/_logs/2019-01-01T19_50_37_363Z-debug.log"

我尝试过的方法: 删除node-modules和package-lock.json,然后安装npm, 将本机降级到版本0.55.4, 使用“ react-native start --reset-cache”清除缓存。

我应该怎么做才能成功运行模拟器而不会出现错误?

0 个答案:

没有答案