V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
fyxtc
V2EX  ›  程序员

见鬼了啊,为什么我 git commit 会报 npm ERR! Missing script: "tsc-verify",就没法提交了, google 都搜不到这个错,求助一下 v 友们

  •  
  •   fyxtc · 332 天前 · 1500 次点击
    这是一个创建于 332 天前的主题,其中的信息可能已经有所发展或是发生改变。

    diff 显示只改了 package.json, package-lock.json 和一个 tsx 文件
    npm ERR! Missing script: "tsc-verify"
    npm ERR! npm ERR! To see a list of scripts, run: npm ERR! npm run

    npm ERR! A complete log of this run can be found in: npm ERR! /Users/hikaru/.npm/_logs/2023-05-30T03_25_00_899Z-debug-0.log

    Errors encountered when running pre-commit script. Won't commit. Review your changes and try again.

    没法提交上去了

    8 条回复    2023-05-30 21:10:09 +08:00
    izumiiAoba
        1
    izumiiAoba  
       332 天前   ❤️ 1
    会不会是有 git hook 调用了 `npm run tsc-verify`,然后可能你没有装包所以会报这个错误。
    可以看下 package.json 里面这个命令在不在,或者试下自己手动能不能 run
    alteremliu
        2
    alteremliu  
       332 天前   ❤️ 1
    git hook 吧
    webluoye
        3
    webluoye  
       332 天前   ❤️ 1
    就是这个“ pre-commit script” 提交前的检查。
    L2Sddiw
        4
    L2Sddiw  
       332 天前   ❤️ 1
    你进入包含你的项目的根目录。试着运行 npm run 命令,以查看可用的脚本列表。检查列出的脚本中是否包含名为"tsc-verify"的脚本。如果不存在该脚本,那么可能需要根据你的项目需求进行相应的设置。

    如果你已经知道要运行的脚本是什么,可以直接运行该脚本。例如,如果你知道要运行的脚本是"build",可以运行 npm run build 命令。
    flyingfishzxf
        5
    flyingfishzxf  
       332 天前   ❤️ 1
    有个方案是进入 .git/hooks 目录里面,把 pre-commit 和 commit-msg 删掉,我最近使用一个后台模板也遇到这问题
    mxT52CRuqR6o5
        6
    mxT52CRuqR6o5  
       332 天前   ❤️ 1
    git commit -m 'XXX' --no-verify
    慎用
    fyxtc
        7
    fyxtc  
    OP
       332 天前   ❤️ 1
    @izumiiAoba
    @alteremliu
    @webluoye
    @L2Sddiw
    @flyingfishzxf
    @mxT52CRuqR6o5

    感谢各位提供的帮助,原来是最近直接从 github 安装的项目可能带了 pre-commit ,导致我安装后就也生成了一个 pre-commit ,看了时间确实今天生成的,删了就解决了,帮大忙了,谢谢各位
    fyxtc
        8
    fyxtc  
    OP
       332 天前
    而且刚好.git 目录是 diff 看不到了。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2599 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 15:45 · PVG 23:45 · LAX 08:45 · JFK 11:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.