Vue框架学习笔记(一)框架搭建

1、安装node.js

  1)在https://nodejs.org/en/download/ 下载最新linux nodejs包,以v10.15.3为例:

wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.gz
tar zxvf node-v10.15.3-linux-x64.tar.gz
mv node-v10.15.3-linux-x64 /usr/local/nodejs
ln -s /usr/local/nodejs/bin/npm /usr/local/bin/ 
ln -s /usr/local/nodejs/bin/node /usr/local/bin/

2、安装cnpm(安装cnpm是因为使用npm install安装包时速度很慢,所以建议安装cnpm后使用cnpm install来安装包):

npm install -g cnpm --registry=https://registry.npm.taobao.org
ln -s /usr/local/nodejs/bin/cnpm /usr/local/bin/

3、安装vue-cli:

cnpm install -g vue-cli
ln -s /usr/local/nodejs/bin/vue /usr/local/bin/

4、安装webpack:

npm install webpack -g --registry=https://registry.npm.taobao.org

5、创建vue项目并发布:

cd /www/htdocs/
vue init webpack mhrvue
cd mhrvue/
cnpm install
cnpm run build

6、部署到apache上:

<VirtualHost *:80>
    DocumentRoot "/www/htdocs/mhrvue/dist"
    Servername mhrv.51job.com
    <Directory "/www/htdocs/mhrvue/dist">
        Options FollowSymLinks
        AllowOverride None
        Require all granted
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.html [L]
    </Directory>
    <IfModule dir_module>
        DirectoryIndex index.html
     </IfModule>
        ErrorLog "|/usr/sbin/cronolog /var/www/logs/error_log%m%d"
        CustomLog "|$ /usr/sbin/cronolog --symlink=/var/www/logs/mhrv_access_log /var/www/logs/mhrv_`hostname`_access_log%m%d%H" combined env=!image-request
</VirtualHost>

 

posted @ 2019-05-15 18:16  fengzmh  阅读(162)  评论(0编辑  收藏  举报