1
votes

I am using NodejsTools in Visual Studio 2013, but can publish my project to Azure. When I build my file I get the following error:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Node.js Tools\Microsoft.NodejsTools.targets(115,5): error MSB4018: The "AssignTargetPath" task failed unexpectedly. System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Any clues on how I can fix this/get my node project to publish up to Azure?

Update 1: If I move the project to a root folder in my Windows C: drive, the build error goes away and build succeeds. However, if I try to publish, it fails and does not give a reason why:

------ Publish started: Project: MyProject, Configuration: Release Any CPU ------ Auto ConnectionString Transformed Web.config into obj\Release\CSAutoParameterize\transformed\Web.config. Copying all files to temporary location below for package/publish: obj\Release\Package\PackageTmp.

========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ========== ========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

2

2 Answers

2
votes

I ran into the same problem. The paths created in the visual studio template are indeed too long to be uploaded on Azure. The paths are probably within your "node_modules" folder.

I solved this problem as follows: Within the project folder, I deleted the folder "node_modules", containing all the modules needed to build your project. You can add these modules later, so no worries.

Open visual studio, reload the solution and publish your project again on your Azure account. Visual Studio probably doesn't return any errors now, since all paths are shorter than 240 characters.

Then, login on the Azure portal, open your web app and click on "add tiles" and add the console tile. Open the console tile and run the command "npm install". This command adds all dependencies within your project, hence adds the folder "node_modules" with all the modules needed for your project. You can see your project and work on them using the "Visual Studio Online Extension".

1
votes

It’s difficult for troubleshooting if there is no error code.

I suggest you need check the <PropertyGroup> values such as <OutputPath>.</OutputPath> and so on in node.js project file which is end with .njsproj. Any information, please share it with me.

And in my test, I have to create a nodejs application via Azure Node.js application template so that I can publish it to Azure Web Apps. enter image description here

You can try to create a new node.js app using Azure Node.js application and to check whether it can be published to Azure Web App. When succeed to publish app to Azure, you can copy your code into this project, then try to publish again.

Any concern, please let me know.