2016-08-21 79 views
0

我有一个“npm安装”的第一步Visual Studio团队服务构建定义。此定义部署到天蓝色的Web应用程序。除非首先删除node_modules文件夹,否则NPM安装不起作用?

NPM完成时没有错误,但是当访问网络应用程序时,会抛出错误“Can not find module'express'”。当从weblog文件和package.json所在的“wwwroot”文件夹手动运行“npm install”命令时,该命令再次成功完成,但错误仍然存​​在。

但是,当我从“wwwroot”文件夹中删除“node_modules”,并再次运行“npm install”时,错误消失,Web应用程序按预期运行!

我该如何解决我的构建定义,以便每个部署都不需要这些手动步骤?

从我的package.json相关的摘录低于:

"dependencies": { 
    "express": "^4.13.4", 
    "pug": "^2.0.0-alpha7", 
    "bluebird": "^3.4.1", 
}, 

故宫日志在下面提供:

2016-08-21T01:19:28.9476070Z ##[debug]check path : C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.104.1\tasks\Npm\0.2.15\task.json 
2016-08-21T01:19:28.9476070Z ##[debug]set resource file to: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.104.1\tasks\Npm\0.2.15\task.json 
2016-08-21T01:19:28.9486073Z ##[debug]system.culture=en-US 
2016-08-21T01:19:28.9646119Z ##[debug]check path : C:\Program Files\nodejs\npm.cmd 
2016-08-21T01:19:28.9656074Z ##[debug]npm=C:\Program Files\nodejs\npm.cmd 
2016-08-21T01:19:28.9666075Z ##[debug]cwd=C:\a\1\s 
2016-08-21T01:19:28.9686074Z ##[debug]path exists: C:\a\1\s 
2016-08-21T01:19:28.9696068Z ##[debug]command=install 
2016-08-21T01:19:28.9696068Z ##[debug]C:\Program Files\nodejs\npm.cmd arg: install 
2016-08-21T01:19:28.9706071Z ##[debug]arguments=null 
2016-08-21T01:19:28.9706071Z ##[debug]exec tool: C:\Program Files\nodejs\npm.cmd 
2016-08-21T01:19:28.9716073Z ##[debug]Arguments: 
2016-08-21T01:19:28.9716073Z ##[debug] install 
2016-08-21T01:19:28.9726071Z [command]C:\Program Files\nodejs\npm.cmd install 
2016-08-21T01:19:43.5330503Z [email protected] C:\a\1\s 
2016-08-21T01:19:43.5330503Z +-- [email protected] 
2016-08-21T01:19:43.5340519Z | +-- [email protected] 
2016-08-21T01:19:43.5340519Z | | +-- [email protected] 
2016-08-21T01:19:43.5340519Z | | | +-- [email protected] 
2016-08-21T01:19:43.5350499Z | | | +-- [email protected] 
2016-08-21T01:19:43.5350499Z | | | `-- [email protected] 
2016-08-21T01:19:43.5360508Z | | `-- [email protected] 
2016-08-21T01:19:43.5360508Z | | `-- [email protected] 
2016-08-21T01:19:43.5370502Z | `-- [email protected] 
2016-08-21T01:19:43.5370502Z | `-- [email protected] 
2016-08-21T01:19:43.5370502Z |  `-- [email protected] 
2016-08-21T01:19:43.5380497Z |  +-- [email protected] 
2016-08-21T01:19:43.5380497Z |  `-- [email protected] 
2016-08-21T01:19:43.5390498Z +-- [email protected] 
2016-08-21T01:19:43.5390498Z | +-- [email protected] 
2016-08-21T01:19:43.5390498Z | | `-- [email protected] 
2016-08-21T01:19:43.5400508Z | | `-- [email protected] 
2016-08-21T01:19:43.5400508Z | +-- [email protected] 
2016-08-21T01:19:43.5420690Z | +-- [email protected] 
2016-08-21T01:19:43.5420690Z | +-- [email protected] 
2016-08-21T01:19:43.5430497Z | +-- [email protected] 
2016-08-21T01:19:43.5430497Z | | `-- [email protected] 
2016-08-21T01:19:43.5440674Z | +-- [email protected] 
2016-08-21T01:19:43.5440674Z | +-- [email protected] 
2016-08-21T01:19:43.5450502Z | +-- [email protected] 
2016-08-21T01:19:43.5450502Z | +-- [email protected] 
2016-08-21T01:19:43.5460530Z | | `-- [email protected] 
2016-08-21T01:19:43.5460530Z | +-- [email protected] 
2016-08-21T01:19:43.5470497Z | +-- [email protected] 
2016-08-21T01:19:43.5470497Z | +-- [email protected] 
2016-08-21T01:19:43.5480496Z | +-- [email protected] 
2016-08-21T01:19:43.5480496Z | | `-- [email protected] 
2016-08-21T01:19:43.5490499Z | +-- [email protected] 
2016-08-21T01:19:43.5490499Z | +-- [email protected] 
2016-08-21T01:19:43.5500513Z | +-- [email protected] 
2016-08-21T01:19:43.5500513Z | | `-- [email protected] 
2016-08-21T01:19:43.5500513Z | +-- [email protected] 
2016-08-21T01:19:43.5510491Z | | +-- [email protected] 
2016-08-21T01:19:43.5510491Z | | `-- [email protected] 
2016-08-21T01:19:43.5520499Z | +-- [email protected] 
2016-08-21T01:19:43.5520499Z | | `-- [email protected] 
2016-08-21T01:19:43.5520499Z | `-- [email protected] 
2016-08-21T01:19:43.5530492Z `-- [email protected] 
2016-08-21T01:19:43.5530492Z +-- [email protected] 
2016-08-21T01:19:43.5540495Z | +-- [email protected] 
2016-08-21T01:19:43.5540495Z | +-- [email protected] 
2016-08-21T01:19:43.5540495Z | +-- [email protected] 
2016-08-21T01:19:43.5550503Z | `-- [email protected] 
2016-08-21T01:19:43.5550503Z +-- [email protected] 
2016-08-21T01:19:43.5550503Z | +-- [email protected] 
2016-08-21T01:19:43.5560494Z | | `-- [email protected] 
2016-08-21T01:19:43.5560494Z | | `-- [email protected] 
2016-08-21T01:19:43.5570499Z | +-- [email protected] 
2016-08-21T01:19:43.5570499Z | | +-- [email protected] 
2016-08-21T01:19:43.5570499Z | | `-- [email protected] 
2016-08-21T01:19:43.5580491Z | +-- [email protected] 
2016-08-21T01:19:43.5580491Z | +-- [email protected] 
2016-08-21T01:19:43.5590498Z | `-- [email protected] 
2016-08-21T01:19:43.5590498Z | +-- [email protected] 
2016-08-21T01:19:43.5590498Z | +-- [email protected] 
2016-08-21T01:19:43.5600495Z | `-- [email protected] 
2016-08-21T01:19:43.5600495Z |  +-- [email protected] 
2016-08-21T01:19:43.5600495Z |  +-- [email protected] 
2016-08-21T01:19:43.5610497Z |  | +-- [email protected] 
2016-08-21T01:19:43.5610497Z |  | | +-- [email protected] 
2016-08-21T01:19:43.5620497Z |  | | | +-- [email protected] 
2016-08-21T01:19:43.5620497Z |  | | | | `-- [email protected] 
2016-08-21T01:19:43.5620497Z |  | | | +-- [email protected] 
2016-08-21T01:19:43.5630568Z |  | | | `-- [email protected] 
2016-08-21T01:19:43.5630568Z |  | | `-- [email protected] 
2016-08-21T01:19:43.5640500Z |  | +-- [email protected] 
2016-08-21T01:19:43.5640500Z |  | `-- [email protected] 
2016-08-21T01:19:43.5640500Z |  +-- [email protected] 
2016-08-21T01:19:43.5650495Z |  `-- [email protected] 
2016-08-21T01:19:43.5650495Z +-- [email protected] 
2016-08-21T01:19:43.5660502Z | +-- [email protected] 
2016-08-21T01:19:43.5660502Z | | `-- [email protected] 
2016-08-21T01:19:43.5660502Z | `-- [email protected] 
2016-08-21T01:19:43.5670500Z | `-- [email protected] 
2016-08-21T01:19:43.5670500Z +-- [email protected] 
2016-08-21T01:19:43.5670500Z | `-- [email protected] 
2016-08-21T01:19:43.5680491Z `-- [email protected] 
2016-08-21T01:19:43.5680491Z  `-- [email protected] 
2016-08-21T01:19:43.5820489Z ##[debug]rc:0 
2016-08-21T01:19:43.5820489Z ##[debug]success:true 
2016-08-21T01:19:43.5830501Z ##[debug]task result: Succeeded 
2016-08-21T01:19:43.6100505Z Finishing task: Npm 

举个例子,在“快车”模块文件夹丢失其“ index.js“,”LICENSE“和”package.json“文件,原因不明。

+0

请提供来自问题主体**中任何日志**的相关文本。要求人们从随机URL下载未知文件是不合适的。这会引起对该问题的负面关注或导致该问题被完全忽略。此外,如果问题依赖于以后可能不存在的文件,则问题在未来与其他问题的关系较小。 – Claies

+0

理解,按现在的要求修改。 – Sam3000

回答

1

我想在我的身边,利用NPM安装>归档文件>复制和发布构建神器>Azure的Web应用程序部署工作流程安装包,包中的应用,并部署到Azure的网站应用。

enter image description here

而且这里有详细的构建步骤参数:

  • enter image description here

  • enter image description here

  • enter image description here

  • enter image description here

而且你可以参考https://www.visualstudio.com/docs/release/examples/nodejs/node-to-azure-webapps#build有关建筑物的详细信息,并部署在类似的情况VSTS的工作流程。

+0

感谢您的真正详细的答案,这是一个轻微的变体,其中“Prefix root folder to named to archive paths”未勾选解决了我的问题! – Sam3000

相关问题