Why is our front-end automation
I believe any language development, no matter what language, the teacher speaks like this, as a developer, your biggest The energy should be placed on the top of the creativity, don’t you repeat myself don’t repeat themselves, and during our development process, there are often a lot of duplicate operations, so we need to go to these operations, more Time to let us create.
Which automation can be brought about by automation:
[12. Automatic deployment (automatically package the project package to the specified directory)
5. Automatic synchronization (easy to implement multiple browsing Window, synchronous click, input, debugging)
Does it feel very angry, can help us do so many things, so let’s take it, this time, including environmental construction, tool construction, The project architecture is built, served, today, the initial construction of the environment, the NodeJs environment is built.
Second, what is node.js?
Third, install node.js
Meet, the original browser will do a lot of things, page rendering, JS rendering, etc., then Node takes the JS rendered engine, and You used Google's V8, and then encapsulated a layer of API outside it, allowing it to have a document reading and writing, network, etc., providing a server running environment, but it is running JavaScipt. So nodejs brought a industrial revolution to the front-end development industry.
There are a variety of ways, https: //nodejs.org/EN/ can be directly in the official website, download Installation version installation, this way is very simple, the next step is solved, there is not much introduction, introduce another way, NVM installation, because sometimes we can use multiple versions of Node, and NVM You can make us use the version of the use of the use of easy to switch.
and then double-click install.cmd will let you enter “an absolute path to compress or decompress files copied to” first do not ignore it, directly enter, after a successful, will generate a text settings.txt at the root of the C drive file, this file to cut C: \ dev \ nvm directory, its contents and then we modified this:
root: C: \ dev \ nvm path: C: \ dev \ nodejs arch: 64 proxy: none
then we started the configuration environment variable, because just click on the file install.cmd, so will the system variables environment variables, generates two environment variables: NVM_HOME and NVM_SYMLINK we start modifying variable values of these two variables name: NVM_HOME of the variable value: C: \ dev \ nvm; NVM_SYMLINK the variable value: C: \ dev \ nodejs
% NVM_SYMLINK%,% NVM_HOME%open cmd , enter the command
to see the version information on the installation was successful
then download nodejs, enter the command,
nvm install lastest can be downloaded Node latest version, if you want to specify the version, may be
nvm install 6.4.0
nvm install 6.4.0 32
because the default is 64-bit
each node version of our installed already comes with a npm, but because we may have to switch nodWhen the E version, then in order to unify, we need to install a global npm
First we enter the command mode, enter npm config set prefix “C: \ DEV \ NVM \ npm”
prefix = C: \ DEV \ NVM \ npm
npm install npm -gwill find the NPM package is being downloaded after entering bus, in C: \ DEV \ NVM \ In the npm directory, you can see the files in the download, and we will install the package in the global path we just configured when using the -g when we use the NPM installation package.
The top of PATH
, pay attention, this must be added before
% NVM_SYMLINK% , so we put it directly to the top of Path
Finally, we will open a command window, enter npm -v, at this time, we use the NPM package we unified to download.
We can also install CNPM tools, which is the Chinese version of the NPM mirror library, address here: https://cnpmjs.org/, is also a copy of NPM official, because we and There is a wall in the outside world, so use this domestic relatively fast, Taobao also got a mirror library like NPM, http: //npm.taobao.org/, it and the official NPM synchronized every 10 minutes. Installation method:
NPM INSTALL -G cnpm --registry = http://r.cnpmjs.org
or with Taobao
After installing CNPM, directly execute
5, NRM installation
What is NRM?
NRM is NPM Registry Manager is also NPM's mirror source management tool, sometimes foreign resources are too slow, then we can use this to switch mirror sources. We only need to pass this command:
npm install -g nrm
Note: -g can be placed directly to INSTALL, we will use this later, because so, we can switch the recent command in the CMD arrow It is easy to modify, more convenient to operate. After the installation is complete, we can use it.
Command: NRM LS
Nrm USE CNPM