目录
安装
以人人开源前端项目安装为例,安装部署及安装过程中的问题的解决思路。开源地址如下:
人人开源
下载代码到本地
安装visial studio code(即VSCode)作为前端开发工具,使用前端前必须安装node.js作为让js运行在服务端的开发平台。
到官网下载node.js,注意下载的版本,版本选取有误可能导致后序安装出现异常。我们这里安装了V12,这里可以看到支持的npm版本,要保持一致。
下载安装完成,在VSCode打开终端,查看版本:
Vue项目的开始与安装也可以参考开源文档:Getting started · renrenio/renren-fast-vue Wiki · GitHub
使用VSCode导入项目
设置镜像,https://registry.npm.taobao.org 已经过期, 使用命令更新为如下镜像:
npm config set registry https://registry.npmmirror.com
这里是阿里镜像,也可以更新为清华、中科院相关的镜像库。
初始化:
npm install
启动项目:
npm run dev
运行成功后,就可以打开访问页面了:
问题解决
-
安装错误,提示pm ERR! chromedriver@2.27.2 install: `node install.js`
找不到chromedriver包,可以手动下载一个放在临时目录下
安装时指定此目录:
npm install chromedriver --chromedriver_filepath=F:\code\workspace\renren-fast-vue\tmp\chromedriver_win32.zip
-
安装中如果出现了sass错误提示
-
执行命令:
npm install --save node-sass
-
gyp ERR! stack Error: Could not find any Visual Studio installation to use
yp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (F:\code\workspace\renren-fast-vue\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at F:\code\workspace\renren-fast-vue\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (F:\code\workspace\renren-fast-vue\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack at F:\code\workspace\renren-fast-vue\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack at F:\code\workspace\renren-fast-vue\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at F:\code\workspace\renren-fast-vue\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:315:5)
gyp ERR! stack at ChildProcess.emit (events.js:314:20)
gyp ERR! stack at maybeClose (internal/child_process.js:1022:16)
gyp ERR! System Windows_NT 10.0.19042-
Downloading Python failed. Error: Error: certificate has expired
https://www.python.org/ftp/python/2.7.15/python-2.7.15.amd64.msi 下载安装,如果还不生效,就关闭SSL验证
-
npm config set strict-ssl false
-
提示用powershell执行脚本
Starting installation...
Please restart this script from an administrative PowerShell!
以管理员身份打开powershell,执行命令,运行成功
npm install --global --production windows-build-tools
ERR! stack Error: `gyp` failed with exit code: 1
//删除 .node-gyp/ rm -rf .node-gyp///执行npm i -g node-gyp//删除 项目名称/node_modulesrm -rf proName/node-modules执行npm i -d//最后重新installnpm install