Node.js Azure 构建中的错误
Node.js error in Azure build
我从 Visual Studio 2015 社区版创建了一个全新的 ASP.NET 5 项目。我在此处将代码签入 BitBucket 上的存储库:
https://bitbucket.org/admin_at_scanburapps/sandbox-repo
我在 Azure 上创建了一个新的 Web 应用程序,并从此存储库设置了持续部署。 Azure 取出代码,开始构建并给我这个错误:
> 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)
(查看下面的更多输出)
我已经完成 npm install 和 npm dedupe 并签入 node_modules。我还验证了确实在 node_modules 下找到了 lodash。所以我很困惑为什么它找不到 lodash 模块。
谁能猜出问题出在哪里?
注意:
完整的构建日志显示在这里:
> 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.
我已经成功地使用几乎类似的存储库在 Azure 上设置了持续部署,但我没有遇到此错误。我比较了这两个项目,但找不到解释此错误的任何明显差异。
我删除了 project.json
文件中 "scripts"
部分下的 "gulp clean", "gulp min"
命令,并从 BitBucket 成功部署。
作为解决方法,您可以尝试从代码中删除这两个命令,然后 运行 在本地项目中将它们部署到 Azure Web 应用程序中。
我从 Visual Studio 2015 社区版创建了一个全新的 ASP.NET 5 项目。我在此处将代码签入 BitBucket 上的存储库:
https://bitbucket.org/admin_at_scanburapps/sandbox-repo
我在 Azure 上创建了一个新的 Web 应用程序,并从此存储库设置了持续部署。 Azure 取出代码,开始构建并给我这个错误:
> 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)
(查看下面的更多输出)
我已经完成 npm install 和 npm dedupe 并签入 node_modules。我还验证了确实在 node_modules 下找到了 lodash。所以我很困惑为什么它找不到 lodash 模块。
谁能猜出问题出在哪里?
注意: 完整的构建日志显示在这里:
> 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.
我已经成功地使用几乎类似的存储库在 Azure 上设置了持续部署,但我没有遇到此错误。我比较了这两个项目,但找不到解释此错误的任何明显差异。
我删除了 project.json
文件中 "scripts"
部分下的 "gulp clean", "gulp min"
命令,并从 BitBucket 成功部署。
作为解决方法,您可以尝试从代码中删除这两个命令,然后 运行 在本地项目中将它们部署到 Azure Web 应用程序中。