【问题标题】:Grunt git "typechange: node_modules/.bin/grunt" errorGrunt git“typechange:node_modules/.bin/grunt”错误
【发布时间】:2017-12-18 13:19:20
【问题描述】:

我在一个项目上工作并使用了 grunt,但我的问题是当我尝试创建一个 git add 时。

我收到以下错误是日志。希望有人可以帮助我顺便说一句,我在 Windows 10 上的 vs 代码中使用 PowerShell。我还使用其他终端(如 git bash)进行了测试,但仍然出现相同的错误消息。

期待我们如何解决它的一些想法。

> PS C:\xampp\htdocs\websites\Dropbox\testing-site1> git add . 
> error: open("node_modules/.bin/grunt"): Invalid argument error: unable to index file node_modules/.bin/grunt fatal: updating files failed


> PS C:\xampp\htdocs\websites\Dropbox\testing-site1> git status 
> On branch master Changes not staged for commit:
> typechange: node_modules/.bin/grunt 

我还在目录中有一个 .gitignore 文件,其中包含以下代码以从 git 中排除节点模块,但我仍然得到上面解释的这个问题。

node_modules/

提前致谢。

【问题讨论】:

    标签: git bash powershell gruntjs


    【解决方案1】:

    您的.gitignore 似乎不起作用。

    我猜你的 .gitignore 是在一些提交之后添加的。

    这种情况你可以试试:

    1. 递归地从 git 索引中删除文件的路径。
    2. 然后将它们添加回来。

    您可以通过运行以下命令来做到这一点:

    git rm -r --cached .
    git add .
    git commit -m "Make .gitignore work successfully"
    

    注意:您可能想先在项目目录的副本上尝试上述方法作为测试。

    【讨论】:

    • 非常感谢再次感谢它:)
    猜你喜欢
    • 1970-01-01
    • 2016-01-23
    • 1970-01-01
    • 2015-03-23
    • 1970-01-01
    • 1970-01-01
    • 2015-03-07
    • 2015-04-07
    • 2016-07-24
    相关资源
    最近更新 更多