Node.js error in Azure build

ぐ巨炮叔叔 提交于 2019-12-24 13:52:28

问题


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


回答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.



来源:https://stackoverflow.com/questions/35158159/node-js-error-in-azure-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!