Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 正在VSTS/TFS中运行webpack,找不到webpack_Node.js_Tfs_Asp.net Core_Webpack_Azure Pipelines - Fatal编程技术网

Node.js 正在VSTS/TFS中运行webpack,找不到webpack

Node.js 正在VSTS/TFS中运行webpack,找不到webpack,node.js,tfs,asp.net-core,webpack,azure-pipelines,Node.js,Tfs,Asp.net Core,Webpack,Azure Pipelines,在VSTS的构建过程中,我运行 npm install-g webpack然后npm install webpack都将工作目录设置为网站项目目录(project.json和其他主文件所在的目录与解决方案目录相对) 然后在命令行任务中运行where-webpack 或powershell任务中的Get命令-CommandType应用程序-ErrorAction SilentlyContinue-Name网页|选择对象-ExpandProperty定义| echo 它们都只返回空字符串 因此,显然

在VSTS的构建过程中,我运行
npm install-g webpack
然后
npm install webpack
都将工作目录设置为网站项目目录(project.json和其他主文件所在的目录与解决方案目录相对)

然后在命令行任务中运行
where-webpack

或powershell任务中的
Get命令-CommandType应用程序-ErrorAction SilentlyContinue-Name网页|选择对象-ExpandProperty定义| echo

它们都只返回空字符串

因此,显然,运行nig
webpack-p
作为下一个命令只返回“notfound”类型的响应

术语“webpack”不能识别为cmdlet、函数、脚本文件或可操作程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。

以下是全球网络的npm列表:

2016-11-04T15:11:38.0395583Z ##[section]Starting: npm install
2016-11-04T15:11:38.6826226Z [command]C:\Program Files\nodejs\npm.cmd install -g webpack
2016-11-04T15:11:48.7566299Z C:\Users\SrvBuildAgentUser\AppData\Roaming\npm\webpack -> C:\Users\SrvBuildAgentUser\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js
2016-11-04T15:11:48.8726415Z C:\Users\SrvBuildAgentUser\AppData\Roaming\npm
2016-11-04T15:11:48.8726415Z `-- webpack@1.13.3 
2016-11-04T15:11:48.8726415Z 
2016-11-04T15:11:48.8736416Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\webpack\node_modules\chokidar\node_modules\fsevents):
2016-11-04T15:11:48.8976440Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
2016-11-04T15:11:48.9066449Z ##[section]Finishing: npm install
而对于一个没有全球的:

2016-11-04T15:11:48.9086451Z ##[section]Starting: npm install
2016-11-04T15:11:49.5467089Z [command]C:\Program Files\nodejs\npm.cmd install webpack
2016-11-04T15:11:56.8194361Z asp.net@1.0.0 C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite
2016-11-04T15:11:56.8204362Z +-- UNMET DEPENDENCY rxjs@5.0.0-beta.12
2016-11-04T15:11:56.8204362Z `-- webpack@1.13.3 
2016-11-04T15:11:56.8204362Z 
2016-11-04T15:11:56.8214363Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
2016-11-04T15:11:56.8214363Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
2016-11-04T15:11:56.8224364Z npm WARN asp.net@1.0.0 requires a peer of rxjs@5.0.0-beta.12 but none was installed.
2016-11-04T15:11:56.8504392Z ##[section]Finishing: npm install
然后,
webpack-p
将以以下方式失败:

2016-11-04T15:11:56.8524394Z ##[section]Starting: PowerShell Script
2016-11-04T15:11:56.9024444Z ##[command]. 'C:\Users\SrvBuildAgentUser\AppData\Local\Temp\d8093b24-25d4-4c1d-aeab-5f9f41abb954.ps1' 
2016-11-04T15:11:57.9345476Z C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite
2016-11-04T15:11:58.4295971Z ##[error]webpack : The term 'webpack' is not recognized as the name of a cmdlet, functio
n, script file, or operable program. Check the spelling of the name, or if a pa
th was included, verify that the path is correct and try again.
At C:\Users\SrvBuildAgentUser\AppData\Local\Temp\d8093b24-25d4-4c1d-aeab-5f9f41
abb954.ps1:7 char:1
+ webpack -p
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (webpack:String) [], CommandNotF 
   oundException
    + FullyQualifiedErrorId : CommandNotFoundException


2016-11-04T15:11:58.4355977Z ##[error]Process completed with exit code 0 and had 1 error(s) written to the error stream.
2016-11-04T15:11:58.4375979Z ##[section]Finishing: PowerShell Script
所以我甚至将node_modules/.bin/推到repo,并尝试运行
node_modules\.bin\webpack

因此它找到了网页包,但它弄乱了路径,找不到一些模块:

2016-11-04T14:47:02.4346130Z ##[section]Starting: Run node_modules\.bin\webpack
2016-11-04T14:47:02.4366130Z ##[command]node_modules\.bin\webpack -p
2016-11-04T14:47:04.6596130Z Hash: 6a3774e770e7be6ac786
2016-11-04T14:47:04.6596130Z Version: webpack 1.13.3
2016-11-04T14:47:04.6596130Z Time: 925ms
2016-11-04T14:47:04.6596130Z            Asset       Size  Chunks             Chunk Names
2016-11-04T14:47:04.6596130Z vendor.bundle.js  734 bytes       0  [emitted]  vendor
2016-11-04T14:47:04.6596130Z   main.bundle.js    33.4 kB    1, 0  [emitted]  main
2016-11-04T14:47:04.6596130Z    [0] ./app/main.js 500 bytes {1} [built] [2 errors]
2016-11-04T14:47:04.6596130Z    [1] ./app/Helpers.js 1.62 kB {1} [built]
2016-11-04T14:47:04.6596130Z    [2] ./app/ProductAccessibilityValidator.js 2.06 kB {1} [built] [2 errors]
2016-11-04T14:47:04.6606130Z    [3] ./app/UserProfileProvider.js 1.74 kB {1} [built] [3 errors]
2016-11-04T14:47:04.6606130Z   [10] ./app/app.routing.js 1.93 kB {1} [built] [1 error]
2016-11-04T14:47:04.6606130Z   [11] ./app/component.js 1.22 kB {1} [built] [1 error]
2016-11-04T14:47:04.6606130Z   [20] ./app/module.js 4.09 kB {1} [built] [4 errors]
2016-11-04T14:47:04.6606130Z     + 14 hidden modules
2016-11-04T14:47:04.6606130Z 
2016-11-04T14:47:04.6606130Z WARNING in main.bundle.js from UglifyJs
2016-11-04T14:47:04.6606130Z Side effects in initialization of unused variable SearchResult [./app/components/search-page.component.js:20,0]
2016-11-04T14:47:04.6606130Z Side effects in initialization of unused variable SearchResult [./app/components/product-search.component.js:20,0]
2016-11-04T14:47:04.6606130Z 
2016-11-04T14:47:04.6606130Z ERROR in ./app/main.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '@angular/platform-browser-dynamic' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z  @ ./app/main.js 2:33-77
2016-11-04T14:47:04.6606130Z 
2016-11-04T14:47:04.6606130Z ERROR in ./app/main.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '@angular/core' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z  @ ./app/main.js 3:13-37
2016-11-04T14:47:04.6606130Z 
2016-11-04T14:47:04.6606130Z ERROR in ./app/module.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '@angular/core' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z  @ ./app/module.js 11:13-37
2016-11-04T14:47:04.6606130Z 
2016-11-04T14:47:04.6606130Z ERROR in ./app/module.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '@angular/platform-browser' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z  @ ./app/module.js 12:25-61
2016-11-04T14:47:04.6606130Z 
2016-11-04T14:47:04.6606130Z ERROR in ./app/module.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '@angular/forms' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z  @ ./app/module.js 13:14-39
2016-11-04T14:47:04.6606130Z 
2016-11-04T14:47:04.6606130Z ERROR in ./app/module.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '@angular/http' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z  @ ./app/module.js 14:13-37
2016-11-04T14:47:04.6606130Z 
2016-11-04T14:47:04.6606130Z ERROR in ./app/app.routing.js
2016-11-04T14:47:04.6606130Z Module not found: Error: Cannot resolve module '@angular/router' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6606130Z  @ ./app/app.routing.js 2:15-41
2016-11-04T14:47:04.6606130Z 
2016-11-04T14:47:04.6606130Z ERROR in ./app/component.js
2016-11-04T14:47:04.6616130Z Module not found: Error: Cannot resolve module '@angular/core' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6616130Z  @ ./app/component.js 11:13-37
2016-11-04T14:47:04.6616130Z 
2016-11-04T14:47:04.6616130Z ERROR in ./app/UserProfileProvider.js
2016-11-04T14:47:04.6616130Z Module not found: Error: Cannot resolve module '@angular/core' in C:\agent_work\10\s\mySolution.Web## Heading ##Site\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6616130Z  @ ./app/UserProfileProvider.js 14:13-37
2016-11-04T14:47:04.6616130Z 
2016-11-04T14:47:04.6616130Z ERROR in ./app/UserProfileProvider.js
2016-11-04T14:47:04.6616130Z Module not found: Error: Cannot resolve module '@angular/http' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app
2016-11-04T14:47:04.6616130Z  @ ./app/UserProfileProvider.js 15:13-37
2016-11-04T14:47:04.6616130Z 
2016-11-04T14:47:04.6616130Z ERROR in ./app/components/product-search.component.js
2016-11-04T14:47:04.6616130Z Module not found: Error: Cannot resolve module '@angular/core' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app\components
2016-11-04T14:47:04.6616130Z  @ ./app/components/product-search.component.js 14:13-37 15:13-37
2016-11-04T14:47:04.6616130Z 
2016-11-04T14:47:04.6616130Z ERROR in ./app/components/product-search.component.js
2016-11-04T14:47:04.6616130Z Module not found: Error: Cannot resolve module '@angular/http' in C:\agent_work\10\s\mySolution.WebSite\src\mySolution.WebSite\wwwroot\app\components
2016-11-04T14:47:04.6616130Z  @ ./app/components/product-search.component.js 16:13-37
(and so on)
你能帮我修一下吗


问题在于节点的全局目录可能不在运行VSTS代理的用户的路径中。
在全局安装后,您可能可以使用
C:\NPM\Modules\webpack
将webpack cmd helper作为目标。您可以将与VST集成的webpack从Marketplace添加到您的VST中。
然后就像Gulp一样,您可以运行网页包文件。

我已经更正了您的答案,它在使用绝对路径时会看到网页包。现在它工作了,谢谢。也许编辑出了问题,但我没有看到任何变化,我尝试了这条路径,但它不工作,你最后使用的路径是什么?