taofed / react-web

A framework for building web apps with React Native compatible API.
Other
3.36k stars 449 forks source link

编译没过,新手求指导 #253

Open xiang193 opened 7 years ago

xiang193 commented 7 years ago

react-native init test react-web init test cd test

cd test && npm install 安装依赖包的时候,有些报了一些warning,提示包的依赖问题 用cnpm一个一个安装之后,执行npm install 没有warning了 但是在 执行 react-web start 报下面的错误 Error: Can't find webpack config file at "....node_modules/_react-web@0.4.6@react-web/web/webpack.config.js"

xiang193 commented 7 years ago

webpack.config.js 这个文件在其实在这个路径下有 "....node_modules/_react-web@0.4.6@react-web/webpack.config.js" demo里面这个文件的路径是"....node_modules/_react-web@0.4.6@react-web/webpack.config.js"

尝试把"....node_modules/_react-web@0.4.6@react-web/webpack.config.js" copy到"....node_modules/_react-web@0.4.6@react-web/web/webpack.config.js" 但是会报别的错误

xiang193 commented 7 years ago

是不是我哪里配置有问题,或者哪里没改对 新建了项目之后就没有改过,都是init之后的

xiang193 commented 7 years ago

提示warning是说某些包因为版本不对没有install 我就把包按照提示的版本都安装了一下

xiang193 commented 7 years ago

编译过了,后面有问题再看吧 修改了一个路径 react-web/local-cli/defaultConfig.js

 //const WEBPACK_CONFIG = 'web/webpack.config.js';
 const WEBPACK_CONFIG = 'webpack.config.js';
xiang193 commented 7 years ago

3000端口是开了,貌似还是有问题,页面没响应 DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.

xiang193 commented 7 years ago

node 7.6.0 升级中

xiang193 commented 7 years ago

升级之后,我就彻底放弃了

sandofsuro commented 7 years ago

npm run demo 能跑吗

xiang193 commented 7 years ago

换了版本之后 react-web init 都会失败报错

Error: Couldn't find preset "react-native" relative to directory "/Users/xiang/dev-source/java/react/abc"

xiang193 commented 7 years ago

当前版本 ➜ react npm -v 5.0.1 ➜ react node -v v8.0.0

xiang193 commented 7 years ago

之前node版本是7.6.0,前面的都跑通了,最后启动3000端口都开了,但是访问无效

xiang193 commented 7 years ago

能加个微信么?

xiang193 commented 7 years ago

cd react-web && npm install 错误挺多

4 warnings and 1 error generated.
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/Cellar/node/8.0.0_1/libexec/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:285:23)
gyp ERR! stack     at emitTwo (events.js:125:13)
gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Darwin 16.5.0
gyp ERR! command "/usr/local/Cellar/node/8.0.0_1/bin/node" "/usr/local/Cellar/node/8.0.0_1/libexec/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/xiang/dev-source/java/react/react-web/node_modules/contextify
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok
npm WARN react-web@0.4.6 requires a peer of react@^15.4 but none was installed.
npm WARN react-web@0.4.6 requires a peer of react-dom@^15.4 but none was installed.
npm WARN animated@0.1.3 requires a peer of react@* but none was installed.
npm WARN animated@0.1.3 requires a peer of react-dom@* but none was installed.
npm WARN react-hot-api@0.4.7 requires a peer of react@>=0.11.0 || ^0.14.0-rc but none was installed.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! contextify@0.1.15 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.15 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
sandofsuro commented 7 years ago

如果你不是执意要跟这个安装过程刚下去的话,可以先用这个去跑:https://github.com/sandofsuro/NectarBoxOnWeb 配置好入口文件,用npm run demo去跑,pages里面是可以看到打包结果的。

shijinwu commented 7 years ago

报错,查看原因是 node版本高, 有不降node 版本的解决方案吗,谢谢