【问题标题】:Azure git deploy of node project failing节点项目的 Azure git 部署失败
【发布时间】:2015-04-05 00:13:39
【问题描述】:

我正在尝试将我的项目部署到 azure。它失败了。这些是我采取的步骤。

git init
git config core.longpaths true
git add .
git commit -m "initial commit"

一切正常。我将 git 配置为接受长路径,因为我需要 chokidar,并且 chokidar 有一些深度嵌套的依赖项,如果没有这个,可以最大限度地超出 git 的字符限制。然后我转到 azure,创建一个新的 Web 应用程序,选择自定义,从本地 git 存储库部署,将远程存储库添加到本地 git。一切正常。但是当我运行git push azure master 时,我得到了这个错误:

remote: Updating branch 'master'.
remote: Deployment failed
remote: Error - Changes committed to remote repository but deployment to website failed.

所以我去了一个空目录,启用了长路径,然后克隆了 repo。它给了我这个错误:

remote: warning: unable to access 'node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/regex-cache/node_modules/benchmarked/node_modules/file-reader/node_modules/map-files/node_modules/globby/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/.gitattributes': Filename too long
remote: Counting objects: 5183, done.
remote: Compressing objects: 100% (3893/3893), done.
remote: Total 5183 (delta 489), reused 5183 (delta 489)
Receiving objects: 100% (5183/5183), 4.05 MiB | 1.51 MiB/s, done.
Resolving deltas: 100% (489/489), done.
Checking connectivity... done.
fatal: cannot create directory at 'node_modules/chokidar/node_modules/anymatch/node_modules/micromatch/node_modules/regex-cache/node_modules/benchmarked/node_modules/file-reader/node_modules/map-files/node_modules/globby/node_modules/array-union/node_modules/array-uniq': Filename too long
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status' and retry the checkout with 'git checkout -f HEAD'

还有很多像上面第一个这样的错误。所以我认为在他们的服务器上运行的 Git Azure 没有配置为接受长文件路径?我可以从版本控制中删除 node_modules 并配置 azure 以下载它们吗?

【问题讨论】:

    标签: node.js git azure


    【解决方案1】:

    你是对的

    1. 将 /node_modules 添加到 .gitignore。
    2. 将依赖项添加到您的 packages.json 并让 Azure 在部署时安装它们(每个新/更新的包只安装一次)。

    PS:由于您已经将 /node_modules 文件夹推送到版本控制中,因此您必须先将其删除。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-11
    • 1970-01-01
    • 2014-06-17
    • 2023-04-03
    • 2019-03-15
    • 1970-01-01
    相关资源
    最近更新 更多