git commit提交报错

git commit -m '名字’时报一下错误:

[FAILED] npm run lint-staged:js [FAILED]
[FAILED] npm run lint-staged:js [FAILED]
[SUCCESS] Running tasks for staged files..


npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Program Files\nodejs\node_cache\_cacache\tmp\6e53bf01
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_cache\_cacache\tmp\6e53bf01'
npm ERR!   errno: -4048,
npm ERR!   syscall: 'open',
npm ERR!   path: 'C:\\Program Files\\nodejs\\node_cache\\_cacache\\tmp\\6e53bf01'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! Log files were not written due to an error writing to the directory: C:\Program Files\nodejs\node_cache\_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

错误引起:

git提交时的检测代码规范机制

解决方案:

搜的方法是说:

  1. 检查lint-staged配置:在项目的package.json文件中,找到lint-staged字段
  2. 清除缓存: npm cache claen
  3. 我用的是以下方法,用来跳过检测机制,输入一下命令:
git commit --no-verify -m '提交名'
  1. 找到根目录.eslintignore文件,将src放入其中,git提交时跳过src目录中的检测机制
node_modules
dist
node_modules/*
src

注意:

使用–no-verify命令时,git将会忽略任何预定义的提交钩子脚本,包括lint-staged脚本,但是绕过提交是有风险的,使用前要自行检查提交的代码。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值