Because busy other things, put the learning of node. js down for almost two months, the world changes really fast, found that many things have changed, Express has been upgraded to 4.x, the change is not small!
My original learning process is installed in the VirtualBox ubuntu.12.04amd64, whim, want to replace UBUNTU.14.04AMD64, found not loaded, and then thought, is not virtualbox the upgrade! Virtaulbox upgrade to the latest 4.3.12 r93733 really can, hehe!
The following is a record of the environment establishment process and related issues:
1, set up a virtual directory, the directory under the Win7 map to Ubuntu, because the relevant software is downloaded under the Win7! Use the command mount-t vboxsf ubtshare/mnt/ubtshare
2, install node, I am downloading the binary package, directly extracted to the main directory, renamed node, and then set up a soft link: ln-s/home/zhoutk/node/bin/node/usr/bin/node; also build npm soft link: ln-s/home/ ZHOUTK/NODE/BIN/NPM/USR/BIN/NPM.
There is a small problem, although NPM can execute, but its corresponding configuration file is not established, when using the command npm config edit error, workaround, you can use the following command to modify the mirror server source while generating the configuration file: NPM Config Set registry http://registry.cnpmjs.org, you can use the command NPM info underscore to verify.
3. I use the Webstorm editor, which uses Java, so I need to install the JDK. Two months ago, I used a webstorm 7, only need to modify ~/.profile on it. Now I'm using Webstorm 8, and I'm always suggesting I can't find jdk!. Depressed, constantly Google, and constantly test found that the need to/etc/environment also do the corresponding changes to do, modify the following:
Path= "...:/usr/lib/jvm/jdk1.7.0_60/bin" classpath=.:/ Usr/lib/jvm/jdk1.7.0_60/lib
Java_home=/usr/lib/jvm/jdk1.7.0_60
4. Install Express: Because the Express 4.x has separated the command-line tools, you only need to install the tool globally: NPM install-g Express-generator
You can use EXPRESS-E Blog to establish the project, the-e parameter refers to the use of Ejs engine, hehe, this parameter has changed! Several NPM commands: npm-d Install (installation package check) NPM udate (update, can be used to repair the installation package) NPM Start (project start, no longer the node app)
5, the use of webstorm, at the same time in Ubuntu and win7_64 under constant test, Ubuntu Webstorm will be in the menu will be garbled in Chinese, the solution is as follows: File->settings->appearance UI Options, tick override default fonts by ... I choose Wen Quan Yi Micro Hei. That is because the default font does not support the Chinese cause.
6. I use the Ejs template, the reference to the JavaScript file must be written: <script src= "" ></script>; can not be simplified into <script src= ""/> This problem has made me very bitter.
7.webstorm Smart tips for express have problems, so solve: file->settings->javascript->libraries Click download button, select Typescript Community stubs, you can find express in the selection. Or go directly to the https://github.com/borisyankov/DefinitelyTyped type definition file.
8. All operations within the same page are left to angular, which is required to be written in Express (Res.redirect) and angular ($window. location= '/';) in order to be normal. I have tried it for a long time to be sure.
9.angular Version Difference: 1.0 to 1.2 to note, angular put ngroute alone, now online source is mostly based on 1.0.*, if you are learning with the latest angular, many times the error is because of this reason. How to solve, their own officer net to see upgrade method, very simple.
Well, remember so much, if you can think of, and then fill.
The start of node. JS Development in Ubuntu