Linux front-end environment setup

Source: Internet
Author: User

1. Download node. js

2. Using the wget command in Linux

wget https://nodejs.org/dist/latest-v6.x/node-v6.12.3-linux-x64.tar.gz

3. Unzip

TAR-XZVF node-v6. 12.3

4. Move node to the/usr/local directory

cd/usr/~/node-v6. 12.3-linux-x64./

5. Add Environment variables

Vim/etc/profile

6. Add a node path

node_home=/usr/local/node-v6.12.3-linux-  x64Path= $PATH: $JAVA _home/bin:$NODE _home/binexport PATH Java_ HOME CLASSPATHnode_home 

7. Reload the file

Source/etc/profile

8. Installing Webpack

NPM Install Webpack-g

9. Create a git code directory

10. Install git

Yum-y Install git

11. Pull Code

12. Go to the project folder, install dependencies

NPM Install  --registry=https://registry.npm.taobao.org

13. Package here to execute

NPM Run Mydist

14. Create a production folder

CD/mkdir PRODUCTCD product# front-end project directory mkdir frontend                           CD frontend# project directory mkdir Mall-fe

15. Copy the dist file to the project directory

Mv/developer/git-repository/mall-fe/dist   /product/frontend/mall-fe/dist

16. Write automated scripts to automate the publishing process above

Create and edit Vim fe-deploy.sh in the/developer directory

#GIT_HOME=/developer/git-repository/Dest_path=/product/frontend/#cd dirif[!-N" $" ]; Then Echo-E"Please enter name!"exit fiif[ $1="Mall-fe" ]; Then Echo-E"========enter mall-fe================"CD $GIT _home$1   ElseEcho-E"Not found!"exitfi#clear git dist echo-E"========clear Git dist================"RM-rf./Dist#git Echo-E"=======git Checkout master================"git checkout master echo-E"=======git pull================"git pull echo-E"=======NPM install================"NPM Install--registry=https://registry.npm.taobao.org#npm run mydist Echo-E"=======NPM Run mydist================"NPM Run Mydistif[-D"./dist" ]; Then #backup Destecho-E"================backup dist====================="RM-RF $DEST _path$1/back/Dist MV $DEST _path$1/dist $DEST _path$1/back/Dist #copy Echo-E"=======copy================"CP-R $GIT _home$1/dist $DEST _path$1#echo result Echo"======= Deploy success================"   ElseEcho"======= Deploy error================"fi

Execution./fe-deploy.sh Mall-fe can be released automatically.

Linux front-end environment setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.