gpt4 book ai didi

azure - Kudu npm 安装失败

转载 作者:行者123 更新时间:2023-12-02 06:19:53 26 4
gpt4 key购买 nike

当我尝试在 Azure 上使用 kudu 部署我的项目时,遇到了一个非常奇怪的错误。

我已经使用 VueJs 使用 dotnet 构建了我的项目。我使用了以下模板“https://github.com/MarkPieszak/aspnetcore-Vue-starter

我现在尝试将 WEBSITE_NODE_DEFAULT_VERSION 设置为几个不同的版本,但没有任何运气。

以下是 Kudu 的输出:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
Restore completed in 735.88 ms for D:\home\site\repository\projectx.csproj.
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Restore completed in 345.52 ms for D:\home\site\repository\projectx.csproj.
projectx -> D:\home\site\repository\bin\Release\netcoreapp2.1\projectx.dll
projectx -> D:\home\site\repository\bin\Release\netcoreapp2.1\projectx.Views.dll
NPM Installing dependencies...
npm WARN package.json <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="29485a5a4c5b5d6918071d0718" rel="noreferrer noopener nofollow">[email protected]</a> assert is also the name of a node core module.
npm WARN package.json <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4022352626253200746e796e71" rel="noreferrer noopener nofollow">[email protected]</a> buffer is also the name of a node core module.
npm WARN package.json <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="eb8e9d8e859f98abdac5dac5da" rel="noreferrer noopener nofollow">[email protected]</a> events is also the name of a node core module.
npm WARN package.json <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="523b3c36372a3d3412627c627c63" rel="noreferrer noopener nofollow">[email protected]</a> No repository field.
npm WARN package.json <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="374742594e54585352770519061906" rel="noreferrer noopener nofollow">[email protected]</a> punycode is also the name of a node core module.
npm WARN package.json <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="46373323343f3532342f2821067668746876" rel="noreferrer noopener nofollow">[email protected]</a> querystring is also the name of a node core module.
npm WARN package.json <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5b282f2932353c043f3e38343f3e291b6a756a756a" rel="noreferrer noopener nofollow">[email protected]</a> string_decoder is also the name of a node core module.
npm WARN package.json <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="582d2a3418687669697668" rel="noreferrer noopener nofollow">[email protected]</a> url is also the name of a node core module.
npm WARN package.json <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b5e5f42476b1b051a1b051f" rel="noreferrer noopener nofollow">[email protected]</a> util is also the name of a node core module.
npm WARN package.json <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e5939080c89180889589849180c88096d7d5d4d0c8868a88958c898097a5d4cbd3cbd5" rel="noreferrer noopener nofollow">[email protected]</a> No repository field.
EXEC : npm ERR! error : Method Not Allowed [D:\home\site\repository\projectx.csproj]
npm ERR! at errorResponse (D:\Program Files (x86)\npm\1.4.28\node_modules\npm\lib\cache\add-named.js:260:10)
npm ERR! at D:\Program Files (x86)\npm\1.4.28\node_modules\npm\lib\cache\add-named.js:203:12
npm ERR! at saved (D:\Program Files (x86)\npm\1.4.28\node_modules\npm\node_modules\npm-registry-client\lib\get.js:167:7)
npm ERR! at Object.oncomplete (fs.js:108:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "node" "D:\\Program Files (x86)\\npm\\1.4.28\\node_modules\\npm\\bin\\npm-cli.js" "install" "--ignore-scripts"
npm ERR! cwd D:\home\site\repository
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code E405
D:\home\site\repository\projectx.csproj(25,5): error MSB3073: The command "npm install --ignore-scripts" exited with code 1.
Failed exitCode=1, command=dotnet publish "D:\home\site\repository\projectx.csproj" --output "D:\local\Temp\8d65c86f4c7808a" --configuration Release
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\79.11121.3655\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

大家有什么想法吗?该项目在我的计算机上运行良好。

最佳答案

根据您的错误信息,您的问题显然是由于Node版本不正确导致的。您使用的 GitHub 存储库的先决条件之一是 NodeJS >= 8.9.4,但现在您的 Azure WebApp 上的版本是 v0.10.40。正如您所说,已添加 WEBSITE_NODE_DEFAULT_VERSION 设置,但似乎不起作用。

我关注了document添加相同的设置并在 Azure 门户上单击“保存”,如下图所示,然后立即重新启动我的 kudu 控制台并检查我的节点和 npm 版本是否正确。

enter image description here

enter image description here

所以我的建议是:

  1. 请检查您的 WEBSITE_NODE_DEFAULT_VERSION 设置是否添加到正确的字段中。
  2. 您可以尝试手动重新启动 Azure WebApp 以使更改生效。

关于azure - Kudu npm 安装失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53676820/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com