【问题标题】:How to install fibers package on Azure Web App如何在 Azure Web App 上安装纤程包
【发布时间】:2020-07-26 22:03:06
【问题描述】:

我无法在依赖于fibers package 的 Azure Web App 上使用 Vuetify 安装应用程序。

这个包总是失败,即使尝试单独安装它 (npm install fibers)。

我运行一个带有 Node LTS 堆栈的简单 Windows 机器。虽然我尝试过使用其他堆栈,甚至 Linux 也有类似的结果。

输出消息提供了一种自行构建包的替代方法,但这些指南需要管理权限,这在 Azure Web App 上是不可能的(至少据我所知)。

这个包很受欢迎,这应该是 Azure 开发人员的一个普遍问题,对吧?

这里是 CMD 的完整输出消息(通过 Kudu):

D:\home\site\wwwroot>npm install fibers
gyp ERR! build error 
gyp ERR! stack Error: `D:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program Files (x86)\npm\6.12.0\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "D:\\Program Files (x86)\\nodejs\\12.13.0\\node.exe" "D:\\Program Files (x86)\\npm\\6.12.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd D:\home\site\wwwroot\node_modules\fibers
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'` 
Alpine users please run: `sudo apk add python make g++`
'nodejs' is not recognized as an internal or external command,
operable program or batch file.
npm WARN enoent ENOENT: no such file or directory, open 'D:\home\site\wwwroot\package.json'
npm WARN wwwroot No description
npm WARN wwwroot No repository field.
npm WARN wwwroot No README data
npm WARN wwwroot No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fibers@5.0.0 install: `node build.js || nodejs build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the fibers@5.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\local\AppData\npm-cache\_logs\2020-07-22T15_13_22_997Z-debug.log

【问题讨论】:

  • 我在 Azure Web 应用程序(节点 10.14)中的光纤模块面临同样的问题。你能在不通过 FTP 上传代码的情况下解决它吗?
  • 还是有问题。就我而言,我从依赖项中删除了包。到目前为止没有问题。
  • 好的。我们正在使用需要 Fiber 模块的 asyncawait。
  • 尝试升级到 Angular 9 时遇到同样的问题

标签: node.js azure azure-web-app-service kudu fibers


【解决方案1】:

在Azure webapp中,node的运行环境比较复杂。 Azure一般只支持基本的npmnpx等全局安装包。其余的我暂时没有遇到。因为环境比较复杂,建议在创建webapp的时候使用Linux runtime environment

问题排查步骤:

  1. 确保本地项目运行正常,upload the codegithub。如果有机密信息,请记住在创建项目时选择private模式。更详细的可以参考我在这篇文章中的回答,可以告诉你how to trouble shooting

  2. 然后使用git continuous deployment 将应用程序部署到 Azure。

一般来说,经过这一步,大部分部署问题都可以解决。如果没有,可以在Action查看具体的错误信息。

当然,如果你不愿意使用git部署,可以在构建后使用FTP发布本地运行代码,前提是git可以部署运行成功。

【讨论】:

  • @Julen 你本地的项目运行正常吗?
  • @Julen 你能提供示例代码吗?如果代码中没有机密信息,可以更好地测试。
  • 本地运行良好。我在 Heroku 中尝试过并安装了光纤 ok。而且我上面的测试不包括任何项目。 'npm install fiber' 在 Azure 上失败了。
  • @Julen 你能把你的代码上传到 github 并使用 git 部署它,仅用于测试目的。测试 Azure 是否支持fibers
  • 对不起,杰森,我不能。 :(
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-01-22
  • 1970-01-01
  • 1970-01-01
  • 2021-06-02
  • 2020-06-27
相关资源
最近更新 更多