npm笔记

npm config set cache "D:\nodejs\node_cache" //设置缓存文件夹
npm config set prefix "D:\nodejs\node_global" //设置全局模块存放路径

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

npm install yarn -g

yarn config set global-folder "路径"
yarn config set cache-folder "路径"

npm install webpack -g
npm install vue -g
npm install @vue/cli –g

vue init webpack 项目名
在项目目录下
npm install axios -s
npm run dev

 

 

加入如下代码
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,PATCH,OPTIONS;
#支持put和delete请求
return 200;
}

在Nginx中这样配置
location /xxx {
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,PATCH,OPTIONS;
return 200;
}
proxy_pass http://xxx/xx;
}

posted @ 2023-10-10 19:44  wujf  阅读(6)  评论(0编辑  收藏  举报