犯错!在Azure应用服务上运行的最大呼叫堆栈大小超过了

发布于 2025-02-01 15:13:31 字数 4263 浏览 3 评论 0原文

我有一个node.js和vue Web应用程序,其中包含BitBucket上的代码,我想在Azure应用程序服务上运行。该代码使用NPM工作区。许多事情有效:

  • 推向main触发新的ORYX在Azure上构建。
  • 构建成功完成。
  • App Service重新启动,找到tar.gz捆绑的node_modules,并尝试安装。

然后NPM引发错误:“超过最大呼叫堆栈大小超过”:

2022-05-26T22:30:56.622181753Z Documentation: http://aka.ms/webapp-linux
2022-05-26T22:30:56.622185053Z NodeJS quickstart: https://aka.ms/node-qs
2022-05-26T22:30:56.622188353Z NodeJS Version : v16.13.1
2022-05-26T22:30:56.622191753Z Note: Any data outside '/home' is not persisted
2022-05-26T22:30:56.622195353Z 
2022-05-26T22:30:57.671975654Z Starting periodic command scheduler: cron.
2022-05-26T22:30:57.819864556Z Found build manifest file at '/home/site/wwwroot/oryx-manifest.toml'. Deserializing it...
2022-05-26T22:30:57.823023597Z Build Operation ID: |mTOdVwRHTgA=.4c8dcbcb_
2022-05-26T22:30:57.840196418Z Environment Variables for Application Insight's IPA Codeless Configuration exists..
2022-05-26T22:30:58.384540918Z Writing output script to '/opt/startup/startup.sh'
2022-05-26T22:30:58.470679226Z Running #!/bin/sh
2022-05-26T22:30:58.470711626Z 
2022-05-26T22:30:58.470717626Z # Enter the source directory to make sure the script runs where the user expects
2022-05-26T22:30:58.470722627Z cd "/home/site/wwwroot"
2022-05-26T22:30:58.470734227Z 
2022-05-26T22:30:58.470738827Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
2022-05-26T22:30:58.470743427Z if [ -z "$PORT" ]; then
2022-05-26T22:30:58.470748127Z      export PORT=8080
2022-05-26T22:30:58.470752927Z fi
2022-05-26T22:30:58.470757227Z 
2022-05-26T22:30:58.470761427Z echo Found tar.gz based node_modules.
2022-05-26T22:30:58.470766327Z extractionCommand="tar -xzf node_modules.tar.gz -C /node_modules"
2022-05-26T22:30:58.470770927Z echo "Removing existing modules directory from root..."
2022-05-26T22:30:58.470775527Z rm -fr /node_modules
2022-05-26T22:30:58.470779827Z mkdir -p /node_modules
2022-05-26T22:30:58.470784227Z echo Extracting modules...
2022-05-26T22:30:58.470788627Z $extractionCommand
2022-05-26T22:30:58.470792927Z export NODE_PATH="/node_modules":$NODE_PATH
2022-05-26T22:30:58.470797528Z export PATH=/node_modules/.bin:$PATH
2022-05-26T22:30:58.470802228Z if [ -d node_modules ]; then
2022-05-26T22:30:58.470806628Z     mv -f node_modules _del_node_modules || true
2022-05-26T22:30:58.470823228Z fi
2022-05-26T22:30:58.470827528Z 
2022-05-26T22:30:58.470831428Z if [ -d /node_modules ]; then
2022-05-26T22:30:58.470835428Z     ln -sfn /node_modules ./node_modules 
2022-05-26T22:30:58.470839528Z fi
2022-05-26T22:30:58.470843428Z 
2022-05-26T22:30:58.470847328Z echo "Done."
2022-05-26T22:30:58.478721429Z PATH="$PATH:/home/site/wwwroot" npm i && npm start
2022-05-26T22:30:58.490088376Z Found tar.gz based node_modules.
2022-05-26T22:30:58.490684883Z Removing existing modules directory from root...
2022-05-26T22:30:58.529059677Z Extracting modules...
2022-05-26T22:31:10.105548413Z Done.
2022-05-26T22:31:11.551727987Z npm info it worked if it ends with ok
2022-05-26T22:31:11.560135195Z npm info using [email protected]
2022-05-26T22:31:11.561597313Z npm info using [email protected]
2022-05-26T22:31:15.244181354Z npm info lifecycle [email protected]~preinstall: [email protected]
2022-05-26T22:31:19.567653504Z npm ERR! Maximum call stack size exceeded
2022-05-26T22:31:19.593524734Z npm timing npm Completed in 8150ms
2022-05-26T22:31:19.597115780Z 
2022-05-26T22:31:19.598435196Z npm ERR! A complete log of this run can be found in:
2022-05-26T22:31:19.599027604Z npm ERR!     /root/.npm/_logs/2022-05-26T22_31_19_569Z-debug.log

我不确定该错误的原因,但是我确实注意到该应用程序使用NPM版本6.14.15运行,据我所知不支持NPM工作区。可以升级NPM吗?我尝试使用werebal_npm_default_version,但这似乎没有任何效果。我注意到ORYX构建使用NPM版本8.5.0。

I have a Node.js and Vue web app with code on Bitbucket that I'd like to run on Azure App Service. The code uses npm workspaces. Many things work:

  • Pushing to main triggers a new Oryx build on Azure.
  • The build completes successfully.
  • The app service restarts, finds the tar.gz bundled node_modules, and attempts to install.

Then npm throws an error: "Maximum call stack size exceeded":

2022-05-26T22:30:56.622181753Z Documentation: http://aka.ms/webapp-linux
2022-05-26T22:30:56.622185053Z NodeJS quickstart: https://aka.ms/node-qs
2022-05-26T22:30:56.622188353Z NodeJS Version : v16.13.1
2022-05-26T22:30:56.622191753Z Note: Any data outside '/home' is not persisted
2022-05-26T22:30:56.622195353Z 
2022-05-26T22:30:57.671975654Z Starting periodic command scheduler: cron.
2022-05-26T22:30:57.819864556Z Found build manifest file at '/home/site/wwwroot/oryx-manifest.toml'. Deserializing it...
2022-05-26T22:30:57.823023597Z Build Operation ID: |mTOdVwRHTgA=.4c8dcbcb_
2022-05-26T22:30:57.840196418Z Environment Variables for Application Insight's IPA Codeless Configuration exists..
2022-05-26T22:30:58.384540918Z Writing output script to '/opt/startup/startup.sh'
2022-05-26T22:30:58.470679226Z Running #!/bin/sh
2022-05-26T22:30:58.470711626Z 
2022-05-26T22:30:58.470717626Z # Enter the source directory to make sure the script runs where the user expects
2022-05-26T22:30:58.470722627Z cd "/home/site/wwwroot"
2022-05-26T22:30:58.470734227Z 
2022-05-26T22:30:58.470738827Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
2022-05-26T22:30:58.470743427Z if [ -z "$PORT" ]; then
2022-05-26T22:30:58.470748127Z      export PORT=8080
2022-05-26T22:30:58.470752927Z fi
2022-05-26T22:30:58.470757227Z 
2022-05-26T22:30:58.470761427Z echo Found tar.gz based node_modules.
2022-05-26T22:30:58.470766327Z extractionCommand="tar -xzf node_modules.tar.gz -C /node_modules"
2022-05-26T22:30:58.470770927Z echo "Removing existing modules directory from root..."
2022-05-26T22:30:58.470775527Z rm -fr /node_modules
2022-05-26T22:30:58.470779827Z mkdir -p /node_modules
2022-05-26T22:30:58.470784227Z echo Extracting modules...
2022-05-26T22:30:58.470788627Z $extractionCommand
2022-05-26T22:30:58.470792927Z export NODE_PATH="/node_modules":$NODE_PATH
2022-05-26T22:30:58.470797528Z export PATH=/node_modules/.bin:$PATH
2022-05-26T22:30:58.470802228Z if [ -d node_modules ]; then
2022-05-26T22:30:58.470806628Z     mv -f node_modules _del_node_modules || true
2022-05-26T22:30:58.470823228Z fi
2022-05-26T22:30:58.470827528Z 
2022-05-26T22:30:58.470831428Z if [ -d /node_modules ]; then
2022-05-26T22:30:58.470835428Z     ln -sfn /node_modules ./node_modules 
2022-05-26T22:30:58.470839528Z fi
2022-05-26T22:30:58.470843428Z 
2022-05-26T22:30:58.470847328Z echo "Done."
2022-05-26T22:30:58.478721429Z PATH="$PATH:/home/site/wwwroot" npm i && npm start
2022-05-26T22:30:58.490088376Z Found tar.gz based node_modules.
2022-05-26T22:30:58.490684883Z Removing existing modules directory from root...
2022-05-26T22:30:58.529059677Z Extracting modules...
2022-05-26T22:31:10.105548413Z Done.
2022-05-26T22:31:11.551727987Z npm info it worked if it ends with ok
2022-05-26T22:31:11.560135195Z npm info using [email protected]
2022-05-26T22:31:11.561597313Z npm info using [email protected]
2022-05-26T22:31:15.244181354Z npm info lifecycle [email protected]~preinstall: [email protected]
2022-05-26T22:31:19.567653504Z npm ERR! Maximum call stack size exceeded
2022-05-26T22:31:19.593524734Z npm timing npm Completed in 8150ms
2022-05-26T22:31:19.597115780Z 
2022-05-26T22:31:19.598435196Z npm ERR! A complete log of this run can be found in:
2022-05-26T22:31:19.599027604Z npm ERR!     /root/.npm/_logs/2022-05-26T22_31_19_569Z-debug.log

I'm not sure of the cause of the error, but I did notice that the app is run with npm version 6.14.15, which as far as I'm aware doesn't support npm workspaces. Is it possible to upgrade npm? I tried using WEBSITE_NPM_DEFAULT_VERSION but that didn't appear to have any effect. I noticed that the Oryx build uses npm version 8.5.0.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文