-
淘宝镜像安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install express
-
zsh安装-oh-my-zsh
github地址
手动安装:git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.zshrc ~/.zshrc.orig
chsh -s /bin/zsh
-
node调试
1)Nodejs 使用 Chrome DevTools 调试 –inspect-brk
node –inspect-brk index.js
node –inspect-brk=9229 app.js
一共有两种打开调试工具的方法,第一种是在 Chrome 浏览器的地址栏,键入 chrome://inspect或者about:inspect; 第二种进入调试工具的方法,是在 http://127.0.0.1:3000 的窗口打开”开发者工具”,顶部左上角有一个 Node 的绿色标志,点击就可以进入2)vscode调试
bug =》 添加配置 =》launch.json
// 调试文件,利用program,例如调试vue-cli "configurations": [ { "program": "${workspaceFolder}/vue-cli/bin/vue-init",// 将要进行调试的程序的路径 "args": ["webpack"," my-project"],// 程序调试时传递给程序的命令行参数 "stopAtEntry": false,// 设为true时程序将暂停在程序入口处,一般设置为false "cwd": "${workspaceRoot}",// 可执行程序的启动路径 } ] // 调试npm scripts // 1) 调试node命令 "scripts": { "debug": "node --nolazy --inspect-brk=9229 myProgram.js" } "configurations": [ { "type": "node", "request": "launch", "name": "Launch vue Program", "cwd": "${workspaceFolder}", "runtimeExecutable": "npm", "runtimeArgs": [ "run-script", "dev" ], "port": 9229 } ] // 2) 调试非node命令 --转换成node调用 { ... "scripts": { "debug": "node --inspect-brk=9229 ./node_modules/.bin/rollup -w -c build/config.js --environment TARGET:web-full-dev", }, ... } "configurations": [ { "type": "node", "request": "launch", "name": "Launch vue Program", "cwd": "${workspaceFolder}/2018-12-16-vue源码学习/vue", "stopOnEntry": true, "runtimeExecutable": "npm", "runtimeArgs": [ "run-script", "debug" ], "port": 9229 } ] // 3) auto Attach Feature ctrl+shift+p 选择 debug:toggle auto attach 点击底部 Auto Attach 为 on 命令行输入: node --inspect-brk=9229 ./node_modules/.bin/rollup -w -c build/config.js --environment TARGET:web-full-dev
-
搭建本地服务
使用 express-generator 初始化工程, 然后在目录中放置文件即可
npm install express-generator
npx express --view=ejs myapp
-
npm 安装目录
全局: usr/local/bin 以及 /usr/local/lib/node_modules
局部: 当前项目的 bin目录 以及 node_modules目录 - curl
文档: https://curl.haxx.se/docs/manpage.html 或者使用 man curl 常用的:curl localhost:9999/article -v // (-v 显示详细的请求信息) curl localhost:9999/article -X POST -d "title=comewords&content=articleContent" // (-X POST 来申明我们的请求方法,用 -d 参数,来传送我们的参数) curl localhost:9999/article -X POST -H "Content-Type:application/json" -d '"title":"comewords","content":"articleContent"' // -H 参数来申明请求的 header curl localhost:8000/upimg -F "file=@/Users/fungleo/Downloads/401.png" -H "token: 222" -v // -F "file=@__FILE_PATH__" 的请示,传输文件即可
-
hsts
chrome://net-internals/#hsts -
清理npm缓存: npm cache clean -f –registry=xxx
- 设置ssh
- 查看是否已经有了: cat ~/.ssh/id_rsa.pub
- 生成: ssh-keygen -t rsa -C “your.email@example.com” -b 4096
- 复制到剪切板:
macOS: pbcopy < ~/.ssh/id_rsa.pub GNU/Linux (requires the xclip package): xclip -sel clip < ~/.ssh/id_rsa.pub Windows Command Line: type %userprofile%\.ssh\id_rsa.pub | clip Git Bash on Windows / Windows PowerShell: cat ~/.ssh/id_rsa.pub | clip
- 测试: ssh -T git@example.com (replacing example.com with your GitLab domain)
- 设置多版本node