今天来水一篇文章来讲前端的一些配置。
Node.JS官方网站:https://nodejs.org/zh-cn/
切换Node.JS镜像源
npm config set registry http://registry.npm.taobao.org
全局安装Vue脚手架
npm install -g vue-cli
解锁Windows不安全脚本运行
问题如下:
PS D:\Project-Web> vue
vue : File C:\Users\Shu\AppData\Roaming\npm\vue.ps1 cannot be loaded because running scripts is disabled on this system
. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ vue
+ ~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
解决方法:
PS D:\Project-Web> set-ExecutionPolicy RemoteSigned
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
输入A(全是)
卡 Building fresh packages...
项目目录下创建.npmrc(NPM)或.yarnrc(Yarn)文件,然后填入下放内容保存
registry "https://registry.npm.taobao.org"
sass_binary_site "https://npm.taobao.org/mirrors/node-sass/"
phantomjs_cdnurl "http://cnpmjs.org/downloads"
electron_mirror "https://npm.taobao.org/mirrors/electron/"
sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/"
profiler_binary_host_mirror "https://npm.taobao.org/mirrors/node-inspector/"
chromedriver_cdnurl "https://cdn.npm.taobao.org/dist/chromedriver"