Windows下的webpack项目上传到github,并忽略node_modules文件夹

2 篇文章 0 订阅
1 篇文章 0 订阅

如何上传本地项目到github这些就不说了,
今天遇到一个问题是:本机的webpack项目在npm初始化的时候会生成一个node_modules的巨大的库,我们上传到github时是可以忽略它的。

使用Git Bush(同linux)

做开发的电脑上肯定是安装了git的,进入你的webpack项目,在项目下打开你的git bush,命令行输入:

$ touch .gitignore

这样就新建好了一个.gitignore的文件,接下来打开这个gitignore的文件,在里面输入 node_modules
保存并退出,这样提交项目到github时就会忽略node_modules文件夹啦

使用windows下cmd指令

一百度,发现好多命令行都是针对linux的,windows下的cmd根本不管用啊怒摔!!
自己摸索了下发现下面的的指令是可行的:

cd进入你的webpack项目:输入以下指令用于windows下新建一个.gitignore的文件

echo. >.gitignore

这样就新建好了一个.gitignore的文件,打开这个文件,在里面输入node_modules,保存退出,

然后上次你的webpack项目,这是就发现上传的时候已经忽略了node_modules文件夹了

这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Compiled with problems:X ERROR in ./node_modules/pdfjs-dist/es5/build/pdf.worker.js (./node_modules/vue-pdf/node_modules/worker-loader/dist/cjs.js!./node_modules/pdfjs-dist/es5/build/pdf.worker.js) Module build failed (from ./node_modules/vue-pdf/node_modules/worker-loader/dist/cjs.js): Error: MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead) at Object.tap (D:\newtest\node_modules\webpack\lib\MainTemplate.js:215:12) at WebWorkerMainTemplatePlugin.apply (D:\newtest\node_modules\vue-pdf\node_modules\webpack\lib\webworker\WebWorkerMainTemplatePlugin.js:139:35) at D:\newtest\node_modules\vue-pdf\node_modules\webpack\lib\webworker\WebWorkerTemplatePlugin.js:16:39 at Hook.eval [as call] (eval at create (D:\newtest\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:7:1) at Hook.CALL_DELEGATE [as _call] (D:\newtest\node_modules\tapable\lib\Hook.js:14:14) at Compiler.newCompilation (D:\newtest\node_modules\webpack\lib\Compiler.js:1121:30) at D:\newtest\node_modules\webpack\lib\Compiler.js:1166:29 at Hook.eval [as callAsync] (eval at create (D:\newtest\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:24:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (D:\newtest\node_modules\tapable\lib\Hook.js:18:14) at Compiler.compile (D:\newtest\node_modules\webpack\lib\Compiler.js:1161:28) at Compiler.runAsChild (D:\newtest\node_modules\webpack\lib\Compiler.js:561:8) at Object.pitch (D:\newtest\node_modules\vue-pdf\node_modules\worker-loader\dist\index.js:115:19)
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值