Anthony Dellinger
Anthony Dellinger

Reputation: 107

Azure git deploy of node project failing

I am trying to deploy my project to azure. It is failing. These are the steps I took.

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

All that works. I configured git to accept long paths because I need chokidar, and chokidar has some deeply nested dependencies that max out git's character limit without this. So then I go over to azure, make a new web app, choose custom, deploy from local git repository, add the remote repo to local git. Everything is working. But when I run git push azure master, I get this error:

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

So I went to an empty directory, enabled long paths, and cloned the repo. It gave me this error:

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'

There were a lot more errors like the first above. So I think the Git Azure is running on their server is not configured to accept long file paths? Could I maybe remove node_modules from version control and configure azure to download them?

Upvotes: 4

Views: 2454

Answers (1)

Bruno Faria
Bruno Faria

Reputation: 5262

You are correct

  1. Add /node_modules to .gitignore.
  2. Add dependencies to your packages.json and let Azure install them at deploy (only one-time install for each new/updated package).

PS: Since you already pushed /node_modules folder to the version control you gonna have to remove it first.

Upvotes: 2

Related Questions