Skip to content
This repository has been archived by the owner on May 13, 2019. It is now read-only.

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

Open
xiang193 opened this issue Jun 4, 2017 · 15 comments
Open

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

xiang193 opened this issue Jun 4, 2017 · 15 comments

Comments

@xiang193
Copy link

xiang193 commented Jun 4, 2017

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 xiang193 changed the title 编译不过 编译没过,新手求指导 Jun 4, 2017
@xiang193
Copy link
Author

xiang193 commented Jun 4, 2017

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
Copy link
Author

xiang193 commented Jun 4, 2017

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

@xiang193
Copy link
Author

xiang193 commented Jun 4, 2017

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

@xiang193
Copy link
Author

xiang193 commented Jun 4, 2017

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

 //const WEBPACK_CONFIG = 'web/webpack.config.js';
 const WEBPACK_CONFIG = 'webpack.config.js';

@xiang193
Copy link
Author

xiang193 commented Jun 4, 2017

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

@xiang193
Copy link
Author

xiang193 commented Jun 4, 2017

node 7.6.0 升级中

@xiang193
Copy link
Author

xiang193 commented Jun 4, 2017

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

@sandofsuro
Copy link

npm run demo 能跑吗

@xiang193
Copy link
Author

xiang193 commented Jun 5, 2017

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

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

@xiang193
Copy link
Author

xiang193 commented Jun 5, 2017

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

@xiang193
Copy link
Author

xiang193 commented Jun 5, 2017

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

@xiang193
Copy link
Author

xiang193 commented Jun 5, 2017

能加个微信么?

@xiang193
Copy link
Author

xiang193 commented Jun 6, 2017

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 [email protected] requires a peer of react@^15.4 but none was installed.
npm WARN [email protected] requires a peer of react-dom@^15.4 but none was installed.
npm WARN [email protected] requires a peer of react@* but none was installed.
npm WARN [email protected] requires a peer of react-dom@* but none was installed.
npm WARN [email protected] 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! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@sandofsuro
Copy link

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

@shijinwu
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants