Command `bundle` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.
呃呃,在写下面的代码时出现的问题,解决办法是npm install或者yarn,如果yarn报错,再npm install就可以了
下面的是携程App首页的样式,有轮播,我没有实现出来
代码如下:
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Image,TouchableHighlight,ScrollView} from 'react-native';
// var Swiper= require('react-native-swipe');
// var sliderImgs = [
// 'http://images3.c-ctrip.com/SBU/apph5/201505/16/app_home_ad16_640_128.png',
// 'http://images3.c-ctrip.com/rk/apph5/C1/201505/app_home_ad49_640_128.png',
// 'http://images3.c-ctrip.com/rk/apph5/D1/201506/app_home_ad05_640_128.jpg'
// ];
var BUIcon = [
'https://raw.githubusercontent.com/vczero/vczero.github.io/master/ctrip/%E6%9C%AA%E6%A0%87%E9%A2%98-1.png',
'https://raw.githubusercontent.com/vczero/vczero.github.io/master/ctrip/feiji.png',
'https://raw.githubusercontent.com/vczero/vczero.github.io/master/ctrip/lvyou.png',
'https://raw.githubusercontent.com/vczero/vczero.github.io/master/ctrip/gonglue.png'
];
var Images = [
'http://webresource.c-ctrip.com/ResCRMOnline/R5/html5/images/zzz_pic_salead01.png',
'http://images3.c-ctrip.com/rk/apph5/B1/201505/app_home_ad06_310_120.jpg'
];
// var sliderImgs = [
// 'http://images3.c-ctrip.com/SBU/apph5/201505/16/app_home_ad16_640_128.png',
// 'http://images3.c-ctrip.com/rk/apph5/C1/201505/app_home_ad49_640_128.png',
// 'http://images3.c-ctrip.com/rk/apph5/D1/201506/app_home_ad05_640_128.jpg'
// ];
// class Slider extends Component {
// rennder(){
// return(
// <Swiper style={styles.wrapper} showsButtons={false} autoplay={true} height={150} showsPagination={false}>
// <Image style={[styles.slide,]} source={{uri: sliderImgs[0]}}></Image>
// <Image style={[styles.slide,]} source={{uri: sliderImgs[1]}}></Image>
// <Image style={[styles.slide,]} source={{uri: sliderImgs[2]}}></Image>
// </Swiper>
// );
// }
// }
export default class App extends Component<Props> {
render() {
return (
<ScrollView>
<View style={styles.container}>
<View style={[styles.sbu_view,styles.sub_red,]}>
<View style={[styles.sbu_flex, styles.sbu_borderRight]}>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>酒店</Text>
</View>
<View style={[styles.sub_con_flex]}>
<Image style={[styles.sbu_icon_img]} source={{uri:BUIcon[0]}}></Image>
</View>
</View>
<View style={[styles.sbu_flex, styles.sbu_borderRight]}>
<View style={[styles.sub_con_flex, styles.sub_text, styles.sbu_borderBottom]}>
<Text style={[styles.font16]}>海外</Text>
</View>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>周边</Text>
</View>
</View>
<View style={[styles.sbu_flex]}>
<View style={[styles.sub_con_flex, styles.sub_text, styles.sbu_borderBottom]}>
<Text style={[styles.font16]}>团购.特惠</Text>
</View>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>客栈.公寓</Text>
</View>
</View>
</View>
<View style={[styles.sbu_view, styles.sbu_blue]}>
<View style={[styles.sbu_flex, styles.sbu_borderRight]}>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>机票</Text>
</View>
<View style={[styles.sub_con_flex]}>
<Image style={[styles.sbu_icon_img]} source={{uri:BUIcon[1]}}></Image>
</View>
</View>
<View style={[styles.sbu_flex, styles.sbu_borderRight]}>
<View style={[styles.sub_con_flex, styles.sub_text, styles.sbu_borderBottom]}>
<Text style={[styles.font16]}>火车票</Text>
</View>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>接收机</Text>
</View>
</View>
<View style={[styles.sbu_flex]}>
<View style={[styles.sub_con_flex, styles.sub_text, styles.sbu_borderBottom]}>
<Text style={[styles.font16]}>汽车票</Text>
</View>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>自驾.专车</Text>
</View>
</View>
</View>
<View style={[styles.sbu_view, styles.sbu_green]}>
<View style={[styles.sbu_flex, styles.sbu_borderRight]}>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>旅游</Text>
</View>
<View style={[styles.sub_con_flex]}>
<Image style={[styles.sbu_icon_img]} source={{uri:BUIcon[2]}}></Image>
</View>
</View>
<View style={[styles.sbu_flex, styles.sbu_borderRight]}>
<View style={[styles.sub_con_flex, styles.sub_text, styles.sbu_borderBottom]}>
<Text style={[styles.font16]}>门票.玩乐</Text>
</View>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>出境WiFi</Text>
</View>
</View>
<View style={[styles.sbu_flex]}>
<View style={[styles.sub_con_flex, styles.sub_text, styles.sbu_borderBottom]}>
<Text style={[styles.font16]}>邮轮</Text>
</View>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>签证</Text>
</View>
</View>
</View>
<View style={[styles.sbu_view, styles.sbu_yellow]}>
<View style={[styles.sbu_flex, styles.sbu_borderRight]}>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>攻略</Text>
</View>
<View style={[styles.sub_con_flex]}>
<Image style={[styles.sbu_icon_img]} source={{uri:BUIcon[3]}}></Image>
</View>
</View>
<View style={[styles.sbu_flex, styles.sbu_borderRight]}>
<View style={[styles.sub_con_flex, styles.sub_text, styles.sbu_borderBottom]}>
<Text style={[styles.font16]}>周末游</Text>
</View>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>礼品卡</Text>
</View>
</View>
<View style={[styles.sbu_flex]}>
<View style={[styles.sub_con_flex, styles.sub_text, styles.sbu_borderBottom]}>
<Text style={[styles.font16]}>美食.购物</Text>
</View>
<View style={[styles.sub_con_flex, styles.sub_text]}>
<Text style={[styles.font16]}>更多</Text>
</View>
</View>
</View>
<View style={[styles.img_view]}>
<View style={[styles.img_flex, {borderRightWidth:0.5}]}>
<Image style={[styles.img_wh]} source={{uri:Images[0]}}></Image>
</View>
<View style={[styles.img_flex, {borderLeftWidth:0,}]}>
<Image style={[styles.img_wh]} source={{uri:Images[1]}}></Image>
</View>
</View>
</View>
</ScrollView>
);
}
}
var styles=StyleSheet.create({
container:{
backgroundColor:'#F2F2F2',
flex:1,
},
wrapper:{
height:80,
// resizeMode:Image.resizeMode.contain,
},
sbu_view:{
height:84,
marginLeft:5,
marginRight:5,
borderWidth:1,
borderRadius:5,
marginBottom:10,
flexDirection:'row'
},
sub_red:{
backgroundColor:'#FA6778',
borderColor:'#FA6778',
// marginTop:-70
},
sbu_blue:{
backgroundColor: '#3D98FF',
borderColor:'#3D98FF',
},
sbu_green:{
backgroundColor: '#5EBE00',
borderColor:'#5EBE00',
},
sbu_yellow:{
backgroundColor: '#FC9720',
borderColor:'#FC9720',
},
sbu_flex:{
flex:1,
},
sbu_borderRight:{
borderColor:'#fff',
borderRightWidth: 0.5,
},
sbu_icon_img:{
height:40,
width:40,
// resizeMode:Image.resizeMode.contain,
},
sub_con_flex:{
flex:1,
justifyContent: 'center',
alignItems: 'center',
},
sub_text:{
justifyContent:'center',
},
font16:{
fontSize:17,
color:'#FFF',
fontWeight:'900',
},
sbu_borderBottom:{
borderBottomWidth:0.5,
borderBottomColor:'#fff',
},
img_view:{
height:62,
marginLeft:5,
marginRight:5,
flexDirection: 'row',
marginBottom:20,
backgroundColor:'#fff',
},
img_flex:{
flex:1,
borderWidth:1,
borderColor:'#ccc',
},
img_wh: {
height:59,
borderRightWidth:0,
// resizeMode:Image.resizeMode.contain,
}
})

Command `bundle` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.的更多相关文章
- react-native 引入某些低三方库时出现的Command `run-android` unrecognized,命令不识别错误
在使用第三方库时react-native-swiper,执行 npm install react-native-swiper --save 再次运行react-native run-android时直 ...
- React Native 开发环境安装和配置使用报错: -bash: react-native: command not found
[React Native 开发环境安装和配置:-bash: react-native: command not found 报错: 前提是安装homebrew,node.js ,npm ,watc ...
- 关于出现Not an editor command: Bundle '**/*.vim'的解决方案【转】
转自:https://blog.csdn.net/YHM07/article/details/49717933 操作系统: $ uname -r 2.6.32-573.7.1.el6.x86_64 $ ...
- Node.js log2: ERR when execute command >npm install
1.Node.js创建项目 项目microblog创建成功,提示:cd microblog& npm install 项目创建完成时的目录如下图所示: 2.Node.js错误 如题所言: E ...
- 解决React Native unable to load script from assets index.android.bundle on windows
React Native运行的时候,经常碰到React Native unable to load script from assets index.android.bundle on windows ...
- Mac解决:xcode-select: error: command line tools are already installed, use "Software Update" to install updates
1.因为node项目终端报错: No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'. No receipt for 'com ...
- command failed: npm install --loglevel error --registry=https://registry.npm 用vue-cli 4.0 新建项目总是报错
昨天新买的本本,今天布环境,一安装vue-cli发现都4.0+的版本了,没管太多,就开始新建个项目感受哈,一切运行顺利,输入 "vue create app" 的时候,一切貌似进展 ...
- React Native: unable to load scripts from assets 'index.android.bundle' on real device
问题:重新建了一个项目后,运行react-native run-android报: unable to load scripts from assets 'index.android.bundle' ...
- react native中Unable to load script from assets 'index.android.bundle'解决方案
刚刚朋友问我,说是创建好一个项目,运行后报错:Unable to load script from assets 'index.android.bundle',以前好好的没出现这种现象,于是我找到一个 ...
随机推荐
- Redis事物
redis事物定义: >Redis事务是一个单独的隔离操作:事务中的所有命令都会序列化.按顺序地执行.事务在执行的过程中,不会被其他客户端发送来的命令请求所打断. >Redis事务的主要作 ...
- cmd & tree & bash
cmd & tree & bash bug E: Unable to locate package tree solution # 1. update $ sudo apt-get u ...
- sqlmap-学习1 配置环境
sqlmap是一款非常强大的开源sql自动化注入工具,可以用来检测和利用sql注入漏洞.它由python语言开发而成,因此运行需要安装python环境 1 安装 python (https://www ...
- oracle ceil函数
ceil和floor函数在一些业务数据的时候,有时还是很有用的. ceil(n) 取大于等于数值n的最小整数: floor(n)取小于等于数值n的最大整数 如下例子 SQL> select ce ...
- nginx 正向代理上网
配置文件: server { #resolver 21.202.152.10; #指定DNS服务器IP地址 |如果指定IP$scheme://22.2.65.214$request_uri 可以不指定 ...
- JSON笔记
JSPN示例1: { "firstName": "Brett", "lastName":"McLaughlin", &q ...
- Codeforces 719A 月亮
参考自:https://www.cnblogs.com/ECJTUACM-873284962/p/6395221.html A. Vitya in the Countryside time limit ...
- bzoj1559 [JSOI2009]密码
题目链接:[JSOI2009]密码 我们先看第一问:输出方案数 我们把所有给出来的串丢到AC自动机里面去,然后在建出来的\(trie\)图上跑dp 由于\(n\leq 10\)我们很自然的就想到了状压 ...
- CODEFORCES掉RATING记 #3
比赛:Codeforces Round #426 (Div. 2) 时间:2017.7.30晚 开场先看AB A:给你两个方向,和旋转次数(每次旋转90度),问你旋转方向是什么 B:给你一个字符串,问 ...
- hdu 2955 Robberies (01背包)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2955 思路:一开始看急了,以为概率是直接相加的,wa了无数发,这道题目给的是被抓的概率,我们应该先求出总的 ...