快递破项目

时间:2019-06-10 13:13:25

标签: express react-native

我正在尝试使用express,但是每当我在代码中需要它时,它就会中断我的项目。这就是它的坏处...

var express = require('express');

当我对此发表评论时,我可以构建我的项目,但是当我将其留在里面时,我将无法编译。

这是错误消息。

error: bundling failed: Error: Unable to resolve module `events` from `C:\Users\...\Desktop\React\payme\node_modules\express\node_modules\depd\index.js`: Module `events` does not exist in the Haste module map

这可能与https://github.com/facebook/react-native/issues/4968有关 要解决此问题,请尝试以下操作:

  1. 清晰的守望者手表:watchman watch-del-all
  2. 删除node_modules文件夹:rm -rf node_modules && npm install
  3. 重置Metro Bundler缓存:rm -rf /tmp/metro-bundler-cache-*npm start -- --reset-cache
  4. 删除急速缓存:rm -rf /tmp/haste-map-react-native-packager-*。 在ModuleResolver.resolveDependency(C:\ Users ... \ Desktop \ React \ payme \ node_modules \ metro \ src \ node-haste \ DependencyGraph \ ModuleResolution.js:183:15) 在ResolutionRequest.resolveDependency(C:\ Users ... \ Desktop \ React \ payme \ node_modules \ metro \ src \ node-haste \ DependencyGraph \ ResolutionRequest.js:52:18) 在DependencyGraph.resolveDependency(C:\ Users ... \ Desktop \ React \ payme \ node_modules \ metro \ src \ node-haste \ DependencyGraph.js:283:16) 在Object.resolve(C:\ Users ... \ Desktop \ React \ payme \ node_modules \ metro \ src \ lib \ transformHelpers.js:261:42) 在C:\ Users ... \ Desktop \ React \ payme \ node_modules \ metro \ src \ DeltaBundler \ traverseDependencies.js:399:31 在Array.map() 在resolveDependencies(C:\ Users ... \ Desktop \ React \ payme \ node_modules \ metro \ src \ DeltaBundler \ traverseDependencies.js:396:18) 在C:\ Users ... \ Desktop \ React \ payme \ node_modules \ metro \ src \ DeltaBundler \ traverseDependencies.js:269:33 在Generator.next() 在asyncGeneratorStep(C:\ Users ... \ Desktop \ React \ payme \ node_modules \ metro \ src \ DeltaBundler \ traverseDependencies.js:87:24)

0 个答案:

没有答案