1

좋아요, 필자는 기능이있는 react-native-web 브랜치를 설치하려고 필사적으로 노력하고 있습니다. ListView 구성 요소. This branch, 구체적으로는 이 문제를 가지고하지 않는 것 react-native-web에서 직접 설치 npm install --save [email protected] [email protected] https://github.com/IjzerenHein/react-native-web/tarball/feaure-listview2오류 : 모듈 "react-native"/ 모듈을 찾을 수 없습니다 : 오류 : 모듈 'react-native-web'을 해결할 수 없습니다

:

나는과 같이 프로젝트 디렉토리로 설치되어 있어야합니다.

은 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 내보내기 내에서 사용/예상되는 파일이 있습니다.

이를 극복하는 가장 쉬운 방법은, 저장소를 복제 주어진 브랜치를 체크 아웃, 빌드를 실행하고 대규모 팀이 하나 npm link를 사용하는 경우에 따라하면 로컬 저장소를 연결하거나 .gitignore 푸시에서 dist/을 제거하는 것입니다 브랜치에 파일을 빌드하십시오.

관련 문제