Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何安装与启动 #1

Closed
kenberkeley opened this issue Aug 26, 2016 · 22 comments
Closed

如何安装与启动 #1

kenberkeley opened this issue Aug 26, 2016 · 22 comments

Comments

@kenberkeley
Copy link
Owner

kenberkeley commented Aug 26, 2016

使用 cnpm 替代 npm 可大大减少安装依赖耗时:
npm install -g cnpm --registry=https://registry.npm.taobao.org

首先,您需要打开两个命令窗口,记为窗口 A 和窗口 B
窗口 A 用于启动前端开发服务器,窗口 B 用于启动后端 RESTful API

假设您想在 /Users/ken/ 目录下存放项目代码,那就分别在窗口 A B 敲下:cd /Users/ken 切换到该路径

之后,在窗口 B 中敲下:

$ git clone https://github.com/kenberkeley/msg-board-api.git`
### 拉取代码...

$ cd msg-board-api
$ cnpm i
### 安装依赖...

$ npm start

同样地,在窗口 A 中敲下:

$ git clone https://github.com/kenberkeley/react-demo.git
$ cd react-demo
$ cnpm i
$ npm start

编译完毕后,默认情况下浏览器会自动弹出并访问 localhost:9090

@kenberkeley
Copy link
Owner Author

@SharonLucky 随便打开两个命令窗

@taditang
Copy link

显示需要across-env, 但淘宝的cnpm没找到这个库

@kenberkeley
Copy link
Owner Author

@taditang
cross-env

@taditang
Copy link

恩, 已经发现了

@erdongjun
Copy link

为什么npm start 控制台也没报错 一直是404呢?

@kenberkeley
Copy link
Owner Author

没有报错的话,爱莫能助啊亲。。。

@erdongjun
Copy link

@kenberkeley 我是按照你的教程一步步走的 没有任何的报错 api服务器也启动了,但是在demo编译完成时 控制台打印的access urls 端口 是9001 浏览器打开的是我在配置文件中修改的 9000端口 这是为什么

@erdongjun
Copy link

@kenberkeley 打扰了 ,我再研究下, 您先忙.

@erdongjun
Copy link

抱歉 重新下载安装了 没问题了 ,谢谢您了,

@kenberkeley
Copy link
Owner Author

@davau 解决了就好,嘻嘻

@jimwmg
Copy link

jimwmg commented May 5, 2017

$ npm start

msg-board-api@0.1.0 start F:\04yuannianwork\08redux\ken\msg-board-api
node app.js

[AutoMount] delete /msg/:msgId
[AutoMount] put /msg/:msgId
[AutoMount] get /msg/:msgId
[AutoMount] get /logout
[AutoMount] post /login
[AutoMount] get /user/
[AutoMount] post /msg/
[AutoMount] get /msg/
[INFO] Msg board RESTful API listening at localhost:8989
[LOG] GET /
{ _code: 404, _msg: 'Page not found' }
[LOG] GET /favicon.ico
{ _code: 404, _msg: 'Page not found' }

为啥是8989 好难过,不过写的文章真好

@kenberkeley
Copy link
Owner Author

@jimwmg
Copy link

jimwmg commented May 5, 2017

好用了好用了 谢谢,谢谢 啊哈哈

@jimwmg
Copy link

jimwmg commented May 5, 2017

爱上您啦 写的demo和实例太好了,源码看得我心花路放 谢谢谢谢

@kenberkeley
Copy link
Owner Author

我已经弃 React 坑了,希望大家也转战 Vue 2:https://github.com/kenberkeley/vue2-scaffold

@jimwmg
Copy link

jimwmg commented May 5, 2017

公司最近要用这个,所以来学,vue以后有机会肯定也要学的

@romantiskt
Copy link

建议答主把这个加入到readme中

@Niulimei
Copy link

显示需要across-env, 但淘宝的cnpm没找到这个库

这个问题解决了吗?我这边也是这个问题啊!!!

@Niulimei
Copy link

@taditang

@kenberkeley
Copy link
Owner Author

@Niulimei
Copy link

多谢 @kenberkeley

@wasabi1215
Copy link

Cloning into 'msg-board-api'...
fatal: unable to access 'https://github.com/kenberkeley/msg-board-api.git/': Emp ty reply from server

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

No branches or pull requests

7 participants