1

I have created a brand new ASP.NET 5 project from Visual Studio 2015 Community Edition. I check the code into a repository on BitBucket here:

https://bitbucket.org/admin_at_scanburapps/sandbox-repo

I create a new Web App on Azure and setup continuous deployment from this repository. Azure pulls out the code, start building and gives me this error:

>     module.js:339
>         throw err;
>         ^
>     
>     Error: Cannot find module 'lodash'
>         at Function.Module._resolveFilename (module.js:337:15)
>         at Function.Module._load (module.js:287:25)
>     An error has occurred during web site deployment.
>         at Module.require (module.js:366:17)
>         at require (module.js:385:17)

(See more output below)

I have done npm install and npm dedupe and checked in node_modules. I have also verified that lodash is indeed found under node_modules. So I'm very confused why it cannot find the lodash module.

Can anyone guess what the problem can be?

NB: The complete build log is shown here:

> Command: "D:\home\site\deployments\tools\deploy.cmd" Handling ASP.NET
> 5 Web Application deployment. 'dnx-clr-win-x86.1.0.0-rc1-update1' is
> already installed in
> D:\local\UserProfile\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1.
> Adding
> D:\local\UserProfile\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin
> to process PATH Microsoft .NET Development Utility
> Clr-x86-1.0.0-rc1-16231
> 
>   CACHE https://api.nuget.org/v3/index.json Restoring packages for
> D:\home\site\repository\src\ScanburSandbox\project.json   GET
> https://api.nuget.org/v3-flatcontainer/system.net.sockets/index.json  
> OK
> https://api.nuget.org/v3-flatcontainer/system.net.sockets/index.json
> 1760ms Writing lock file
> D:\home\site\repository\src\ScanburSandbox\project.lock.json Restore
> complete, 11695ms elapsed
> 
> Feeds used:
>     https://api.nuget.org/v3-flatcontainer/ Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16231
> 
> Executing script 'prepublish' in project.json
> - readable-stream@1.0.33 node_modules\gulp-concat\node_modules\readable-stream npm WARN
> ASP.NET@0.0.0 No description npm WARN ASP.NET@0.0.0 No repository
> field. npm WARN ASP.NET@0.0.0 No license field. module.js:339
>     throw err;
>     ^
> 
> Error: Cannot find module 'lodash'
>     at Function.Module._resolveFilename (module.js:337:15)
>     at Function.Module._load (module.js:287:25) An error has occurred during web site deployment.
>     at Module.require (module.js:366:17)
>     at require (module.js:385:17)
>     at Object.<anonymous> (D:\home\site\repository\src\ScanburSandbox\node_modules\globule\lib\globule.js:14:9)
>     at Module._compile (module.js:435:26)
>     at Object.Module._extensions..js (module.js:442:10)
>     at Module.load (module.js:356:32)
>     at Function.Module._load (module.js:311:12)
>     at Module.require (module.js:366:17)
>     at require (module.js:385:17) The 'prepublish' script failed with status code 1.

I have managed to setup continuous deployment on Azure using an almost similar repository where I do not have this error. I have compared the two projects but cannot find any obvious difference explaining this error.

https://github.com/nikolaschou/TodolistService01

Nikola Schou
  • 2,386
  • 3
  • 23
  • 47
  • is "lodash" used by your app? or it is used by one of the dependencies? i don`t see "lodash" from your package.json file. – Xiaomin Wu Feb 05 '16 at 02:17
  • I assume it is used by the dependencies (a transitive dependency) as it is not included by package.json. All I did was to run npm install and npm dedupe. After this lodash is found in the node_modules folder. – Nikola Schou Feb 06 '16 at 08:01

1 Answers1

1

I removed "gulp clean", "gulp min" commands under the "scripts" section in project.json file and deployed successfully from BitBucket.

You can try to remove these two commands from your code, and run them in your local project before you deploying to Azure Web Apps as a workaround.

Gary Liu
  • 13,758
  • 1
  • 17
  • 32
  • Yes, that actually worked so +1 for that. However, I still need other suggestions as it doesn't solve the fundamental problem being that node.js build on Azure continuous deployment fails. – Nikola Schou Feb 04 '16 at 22:38
  • @Gary: Fantastic answer as it solves the issue by removing the two non-essential steps. However, is there a solution to allow to run those two commands in the prepublish step? – Quality Catalyst May 31 '16 at 09:52