2016-06-25 41 views
1

申し訳ありませんが、私は必死に反応するネイティブウェブのブランチをインストールしようとしていますListViewコンポーネント。具体的にはThis branchである。エラー:モジュール「react-native」が見つかりません/モジュールが見つかりません:エラー:モジュール「react-native-web」を解決できません

そうように私は、プロジェクトディレクトリにそれをインストール:react-native-webから直接インストールnpm install --save [email protected] [email protected] https://github.com/IjzerenHein/react-native-web/tarball/feaure-listview2

は、この問題を持っていないようです。

これはindex.web.jsは、次のようになります。ここでは

import React from 'react' 

import { 
AppRegistry, 
Component, 
... 
} from 'react-native'; 

class App extends Component { 
... 
} 

// App registration and rendering 
AppRegistry.registerComponent('App',() => App); 
AppRegistry.runApplication('App', { rootTag:  document.getElementById('react-root') }); 

は、コンソールが(!それの一部、そこにあまりにも多くのテキスト)私に語ったものです:

[Error] ./index.web.js 
Module not found: Error: Cannot resolve module 'react-native-web' in /Users/michael/Code/spectrum-react-native 
resolve module react-native-web in /Users/michael/Code/spectrum-react-native 
    looking for modules in /Users/michael/Code/spectrum-react-native/node_modules 
    resolve 'file' react-native-web in /Users/michael/Code/spectrum-react-native/node_modules 
    resolve file 
    /Users/michael/Code/spectrum-react-native/node_modules/react-native-web is not a file 
    /Users/michael/Code/spectrum-react-native/node_modules/react-native-web.webpack.js doesn't exist 
    /Users/michael/Code/spectrum-react-native/node_modules/react-native-web.web.js doesn't exist 
    /Users/michael/Code/spectrum-react-native/node_modules/react-native-web.js doesn't exist 
    /Users/michael/Code/spectrum-react-native/node_modules/react-native-web.json doesn't exist 
resolve 'file' or 'directory' /Users/michael/Code/spectrum-react-native/node_modules/react-native-web 
    resolve file 
    /Users/michael/Code/spectrum-react-native/node_modules/react-native-web is not a file 
    /Users/michael/Code/spectrum-react-native/node_modules/react-native-web.webpack.js doesn't exist 
    /Users/michael/Code/spectrum-react-native/node_modules/react-native-web.web.js doesn't exist 
    /Users/michael/Code/spectrum-react-native/node_modules/react-native-web.js doesn't exist 
    /Users/michael/Code/spectrum-react-native/node_modules/react-native-web.json doesn't exist 
    resolve directory 
    directory default file index 
     resolve file index in /Users/michael/Code/spectrum-react-native/node_modules/react-native-web 
     /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/index doesn't exist 
     /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/index.webpack.js doesn't exist 
     /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/index.web.js doesn't exist 
     /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/index.js doesn't exist 
     /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/index.json doesn't exist 
    use dist/index.js from package.json 
     resolve 'file' or 'directory' dist/index.js in /Users/michael/Code/spectrum-react-native/node_modules/react-native-web 
     resolve file 
      /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/dist/index.js doesn't exist 
      /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/dist/index.js.webpack.js doesn't exist 
      /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/dist/index.js.web.js doesn't exist 
      /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/dist/index.js.js doesn't exist 
      /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/dist/index.js.json doesn't exist 
     resolve directory 
      /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/dist/index.js doesn't exist (directory default file) 
      /Users/michael/Code/spectrum-react-native/node_modules/react-native-web/dist/index.js/package.json doesn't exist (directory description file) 
    ... 

@ ./index.web.js 9:19-42 
errors (bundle.js:7934) 
onmessage (bundle.js:7969) 
dispatchEvent (bundle.js:2874) 
(anonymous function) (bundle.js:4908) 
forEach 
_transportMessage (bundle.js:4906) 
(anonymous function) 
emit (bundle.js:847) 
onmessage (bundle.js:6261) 
+0

私はちょうど答えを加えました、何かが不明な場合は、私に知らせてください –

答えて

2

問題は、ビルドプロセスがあることです。そうすることで、gitでは無視されるが、npmのエクスポート内では使用/予期されるファイルが存在します。

これを克服するための最も簡単な方法は、リポジトリのクローンを与えられたブランチをチェックアウトし、ビルドを実行するとに応じて、あなたが大規模なチームを持っている場合は、ローカルリポジトリをリンクまたは.gitignoreとプッシュからdist/を削除するnpm linkを使用することですブランチにファイルをビルドします。

関連する問題