启动vue-admin-template-master
无法将“npm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。
解决办法:将vscode设为管理员启动
在启动从GitHub上下载的vue项目时报错:'webpack-dev-server' 不是内部或外部命令,也不是可运行的程序
报错原因:直接从GitHub上下载下来的项目缺少依赖,即:项目里没有node_modules文件夹
解决办法:运行
npm install --registry=https://registry.npm.taobao.org
命令下载依赖即可。
然后运行
npm run dev
报 ERROR in Cannot find module 'node-sass' 错误
因为cnpm安装导致的,换成npm安装就好
npm install node-sass
或者运行
cnpm install node-sass@latest
----接口请求
接口返回格式
{ code: 20000, //代表成功 data: { message: '', result: null } }
src/api下新建xxx.js
import request from '@/utils/request' export function getInfo(data) { return request({ url: '/xxx/getInfo', method: 'get', params: data }) }
调用
import { getInfo } from '@/api/xxx' getInfo(data).then(res => { ... })
----部署
.env.production中修改
VUE_APP_BASE_API = '接口地址'
vue.config.js中修改
module.exports = { publicPath: '/项目名称/', ... }
运行 build:prod
会生成dist文件夹
把dist修改成项目名xxx后放在tomcat运行后发现点击没有请求api
main.js中修改注释
// import { mockXHR } from '../mock' // if (process.env.NODE_ENV === 'production') { // mockXHR() // }
因为node版本问题装不上
1. npm install --legacy-peer-deps
1. npm install --legacy-peer-deps
node.js版本太高导致安装不了node-sass
1.安装低版本node.js,通过nvm切换 nvm use 版本 (nvm ls)
修改版本号的命令
npm version
命令用于更改版本号的信息,并执行commit
操作;该命令执行后, package.json
里的 version
会自动更新。
一般来说,当版本有较大改动时,变更第一位, 执行命令:npm version major -m "description"
, 例如1.0.0
-> 2.0.0
;
当前包变动较小时,可变更第二位,执行命令:npm version minor -m "description"
, 例如: 1.0.0
-> 1.1.0
;
当前包只是修复了些问题时,可变更第三位,执行命令:npm version patch -m "description"
, 例如: 1.0.0
-> 1.0.1
;
修改配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | { "git.path" : "F:/Git/bin/git.exe" , "editor.formatOnSave" : false , // 自动修复 "editor.codeActionsOnSave" : { // 启用eslint格式化工具 "source.fixAll.eslint" : true }, "editor.renderWhitespace" : "boundary" , // 在边界处渲染空格 "files.autoSave" : "afterDelay" , // 延迟自动保存文档 "search.exclude" : { "**/node_modules" : true , "**/bower_components" : true , "**/target" : true , "**/logs" : true , }, // 在使用搜索功能时,将这些文件夹/文件排除在外 "files.exclude" : { "**/.git" : true , "**/.svn" : true , "**/.hg" : true , "**/CVS" : true , "**/.DS_Store" : true , "**/*.js" : { "when" : "$(basename).ts" // ts编译后生成的js文件将不会显示在工作空间中 }, "**/node_modules" : true }, // 这些文件将不会显示在工作空间中 // 配置 ESLint 检查的文件类型 "eslint.validate" : [ "javascript" , "javascriptreact" , "html" , "vue" ], "terminal.integrated.profiles.windows" : { "Git-Bash" : { "path" : "F:\\Git\\bin\\bash.exe" , // gitbashexe的本地路径 "args" : [] } }, "explorer.confirmDelete" : false , "git.autofetch" : true , "workbench.colorTheme" : "Default Light+" , "git.confirmSync" : false , "workbench.editorAssociations" : {}, "terminal.integrated.enableMultiLinePasteWarning" : false , "gitlens.gitCommands.skipConfirmations" : [ "fetch:command" , "stash-push:command" , "switch:command" , "branch-create:command" , "push:command" ], "git.enableSmartCommit" : true , "eslint.codeActionsOnSave.rules" : null } |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步