在 kudu 上运行 "npm install gulp" 时出现错误。

4

我正在运行一个设置,使用Azure Web Apps中的Github部署选项自动部署我的应用程序。然而,我刚刚创建了一个新的Azure Web应用程序,并使用通常的方法将我的应用程序部署到其中,但是这次我的gulpfile.js中的Gulp函数未能运行。

在查看日志后,我发现出现了以下错误:

[17:12:08] Local gulp not found in D:\home\site\repository\src\Hood
[17:12:08] Try running: npm install gulp

我尝试在kudu控制台上直接运行npm install gulp命令。但是我收到了以下错误信息...

D:\home\site\repository>npm install gulp
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "D:\\Program Files (x86)\\nodejs\\4.4.7\\node.exe" "D:\\Program Files (x86)\\npm\\2.15.8\\node_modules\\npm\\bin\\npm-cli.js" "install" "gulp"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! path D:\home\site\repository\node_modules\gulp\node_modules\gulp-util\node_modules\dateformat\node_modules\meow\node_modules\normalize-package-data\node_modules\validate-npm-package-license\node_modules\spdx-correct\node_modules\spdx-license-ids\package.json.1023181798
npm ERR! code EINVAL
npm ERR! errno -4071
npm ERR! syscall rename

npm ERR! EINVAL: invalid argument, rename 'D:\home\site\repository\node_modules\gulp\node_modules\gulp-util\node_modules\dateformat\node_modules\meow\node_modules\normalize-package-data\node_modules\validate-npm-package-license\node_modules\spdx-correct\node_modules\spdx-license-ids\package.json.1023181798' -> 'D:\home\site\repository\node_modules\gulp\node_modules\gulp-util\node_modules\dateformat\node_modules\meow\node_modules\normalize-package-data\node_modules\validate-npm-package-license\node_modules\spdx-correct\node_modules\spdx-license-ids\package.json'
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     D:\home\site\repository\npm-debug.log

以下是我的project.json文件中的scripts部分,请注意,这里应该会安装gulp(如果需要)并运行名为publish的gulp函数...之前一直正常运行...

"scripts": {
    "prepublish": [ "npm install", "bower install", "npm install gulp", "gulp publish" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}

任何想法?

你尝试过错误信息所说的(重命名文件)吗? - Aurora0001
如果那不起作用,尝试 rm -rf ./node-modules 然后运行 npm install - Aurora0001
1
类似问题请参考 https://github.com/npm/npm/issues/9696,您可以尝试在 Azure 上升级 npm 版本至 3.x。 - Gary Liu
谢谢Gary,你说得很对。那就是问题所在,我根据下面David的回答更新到了3.x版本,完美解决了。 - Jorje Redemption
1个回答

3

很可能是Windows路径长度问题。尝试使用npm 3.x版本,因为它可以解决许多这些问题。在Azure应用设置中将WEBSITE_NODE_DEFAULT_VERSION设置为6.9.1,这将为您提供更新的Node和更新的npm。


完美!第一次就成功了。干杯!! - Jorje Redemption

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接