After 8th years of work, I sometimes think that I have learned everything I can learn. In these years, I have learned about two languages from C, C ++, C #, lisp, Ruby, python and JavaScript come all the way and think there is nothing to learn. But I was wrong. Recently I was reading about nodejs, which made me know the cutting-edge technologies in the industry again. I also know that there are still many other things I can learn.
The editor is similar. At the beginning, notepad ++, Vim, emacs, and VIM were returned, so I thought I would never change it again. Until recently, I used sublime text 2 again, it wasn't long before vim was cleared.
For some things I thought I would never learn again, such as Linux kernelProgramI was reading it and found that I couldn't understand it at all. I didn't understand it several times when I picked up the Linux kernel source. It took a long time and I knew it was like a hurdle, it's impossible for me to climb. However, it seems that there have been some changes recently. I am not very confused about Linux kernel. Although I am still confused, I know where to start.
Node. js package management uses NPM (abbreviated as node Package Manager ). The design of the nodejs package is quite different from that of the python Pip and Ruby gem. You can choose whether to install the package in the current directory or the system directory, it is installed in the current directory by default. The obvious advantage is that the package scope you have installed is local. You can install packages of different versions on the same system. Second, you can deploy the project directory before deployment, without installing the corresponding package on the server, which is very useful for the current cloud computing, many cloud services do not provide root permissions, such as openshift of RedHat.
In nodejs, you can run the following command to install a package:
$ NPM install Express
After you execute this command, your current directory will have an additional node_modules Directory, which is the directory of your local package. Your installed Express is just one of the directories. When you install another package, add a corresponding directory under this directory. For example:
$ NPM install ejs
After the installation is complete, we can see the current directory structure:
$ Ls node_modules/ejs Express
We can see that there is only one more ejs directory. If you want to remove a package, you can use:
$ NPM uninstall ejs
One drawback is that the same package needs to be installed multiple times. If a package is referenced by many projects, you can install the package to the system directory (Global Package) so that the new project can directly reference the package without installation.
$ NPM install-G ejs
When both local and global packages exist in the system, the packages installed locally are preferred.
Currently, many designs adopt such examples to differentiate local and global settings. For example, the GIT configuration file has three levels:
-- Local => only effect on current project -- System => Effect on current logined user -- Global => Effect on whole computer