npm安装教程.md 1.5 KB

npm 安装教程

安装方式

安装node v12.16.1,只能安装这个版本,因为要和package.json里的sass版本一致: https://nodejs.org/zh-cn 这里找到历史版本: https://nodejs.org/zh-cn/download/releases

安装cnpm

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

安装vue脚手架和uni-app需要的支持: cnpm install -g @vue/cli cnpm install

运行方式

H5 npm run dev:h5 npm run build:h5

小程序 npm run dev:mp-weixin npm run build:mp-weixin

PC端 npm run serve npm run build

https 转为 http

把https 改变 http,好在本地部署

ghsApp/src/config.js

export const ProjectName = 'ghs'
export const APIHOST = 'http://api.shop.hzghd.com' //https 改为 http
export const IMGHOST = 'https://img.hzghd.com'
export const CURRENT_ENV = 'dev'

ghsApp/src/ext.json

{
	"extEnable": true,
	"extAppid": "wx21b7c3ef12082099",
	"directCommit": false,
	"ext": {
		"account": 12362,
		"apiHost": "http://api.shop.hzghd.com", //https 改为 http
		"socketApiHost": "api.shop.hzghd.com",
		"imgHost": "https://img.hzghd.com",
		"name":"花掌柜"
	}
}

项目里

$service 对应文件 front-end/pt/src/cool/request/index.js

我的执行,会报错,要加上的的命令

nvm use 12.16.1 npm install -g @vue/cli npm install

npm install @dcloudio/uni-mp-weixin 或把 package.json的做修改: "@dcloudio/uni-mp-weixin": "^2.0.0-25120200103006", ==》"@dcloudio/uni-mp-weixin": "^2.0.1-34720220422002",