使用git lint-stag后,再commit时报错 Cannot find module lint-staged
文章来源:https://www.toymoban.com/news/detail-604163.html
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'C:\Users\yunlu\Desktop\yuntuan\yuntuanwebsite\node_modules\lint-staged\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
at Function.Module._load (internal/modules/cjs/loader.js:667:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
husky - pre-commit hook exited with code 1 (error)
重新npm install和npm install lint-stag都不生效,最后把node_modules删掉
,再重新npm install
就好用啦!文章来源地址https://www.toymoban.com/news/detail-604163.html
PS C:\Users\yunlu\Desktop\xxx> npm install
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
> yuntuan-react@0.1.0 prepare
> husky install
husky - Git hooks installed
added 427 packages, removed 42 packages, and changed 290 packages in 2m
PS C:xxx> git commit -m "fix: 更改ws 服务端接口"
> yuntuan-react@0.1.0 lint
> eslint src --fix --ext .ts,.tsx,.vue,.js,.jsx
> yuntuan-react@0.1.0 lint-staged
> lint-staged
Stashing changes... [started]
Stashing changes... [skipped]
→ No partially staged files found...
Running linters... [started]
Running tasks for src/**/*.{js,jsx,vue,ts,tsx} [started]
eslint --ext .js,.jsx,.vue,.ts,.tsx src --fix [started]
eslint --ext .js,.jsx,.vue,.ts,.tsx src --fix [completed]
eslint --fix --max-warnings 0 [started]
eslint --fix --max-warnings 0 [completed]
prettier --write [started]
prettier --write [completed]
git add [started]
git add [completed]
Running tasks for src/**/*.{js,jsx,vue,ts,tsx} [completed]
Running linters... [completed]
[dev db5742da5] fix: 更改ws 服务端接口
1 file changed, 24 insertions(+), 26 deletions(-)
PS C:\Users\yunlu\Desktop\xxx> git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), 3.09 KiB | 4.00 KiB/s, done.
From http://192.168.xx.xxx:xxxx/xxx/yuntuanwebsite
9cfe3c929..002f1a494 dev -> origin/dev
002f1a494..4839e541b feature_login_xxx -> origin/feature_login_xxx
Merge made by the 'ort' strategy.
README.md | 9 +-
src/components/Navigations/Navigation/index.scss | 1 -
.../Navigations/PersonalCenter/index.jsx | 8 --
src/components/Navigations/index.jsx | 12 +-
src/components/RightPopup/index.jsx | 132 +++++++++++++--------
src/components/RightPopup/index.scss | 3 -
src/components/x6_reademe.md | 1 -
src/config/index.js | 20 +---
src/index.css | 19 +--
9 files changed, 90 insertions(+), 115 deletions(-)
到了这里,关于Cannot find module lint-staged 解决办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!