【问题标题】:Package.json specifies Node version but Azure tells me none is specifiedPackage.json 指定节点版本,但 Azure 告诉我没有指定
【发布时间】:2023-03-26 05:03:01
【问题描述】:

我正在尝试为我的 Azure 网站编写自定义部署脚本。我遇到了一些错误,我认为这些错误与使用旧版本 Node 的 Azure 有关。

我在网上找到的所有地方都说要在您的 package.json 文件中指定 Node 版本,如下所示:

"engines" : { "node" : "0.10.26" }

所以我把它放在我的package.json 文件中,但是在推送这些更改后,日志仍然显示消息:

The package.json file does not specify node.js engine version constraints.
The node.js application will run with the default node.js version 0.10.5.

这是怎么回事?

我的package.json 文件:

{ "name": "app-kit", "namespace": "appkit", "APIMethod": "stub", "proxyURL": "http://localhost:8000", "proxyPath": "/api", "version": "0.0.0", "private": true, "directories": { "doc": "doc", "test": "test" }, "engines" : {"node" : "0.10.26"}, "scripts": { "start": "grunt server", "build": "grunt build:debug", "test": "grunt test:ci" }, "repository": { "type": "git", "url": "git://github.com/stefanpenner/ember-app-kit.git" }, "author": "", "license": "MIT", "dependencies" : { "express": "~3.4.8", "lockfile": "~0.4.2", "grunt": "~0.4.2", "grunt-cli": "~0.1.9", "load-grunt-config": "~0.7.0", "grunt-contrib-copy": "~0.4.1", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-jshint": "~0.8.0", "grunt-contrib-uglify": "~0.2.7", "grunt-contrib-cssmin": "~0.6.2", "grunt-preprocess": "~3.0.1", "grunt-es6-module-transpiler": "~0.6.0", "grunt-concat-sourcemap": "~0.4.0", "grunt-concurrent": "~0.4.3", "grunt-usemin": "~0.1.13", "grunt-rev": "~0.1.0", "grunt-ember-templates": "~0.4.18", "originate": "~0.1.5", "grunt-es6-import-validate": "0.0.6", "grunt-contrib-less": "^0.11.0" }, "devDependencies": { "express": "~3.4.8", "lockfile": "~0.4.2", "bower": "~1.2.7", "grunt": "~0.4.2", "grunt-cli": "~0.1.9", "load-grunt-config": "~0.7.0", "grunt-contrib-watch": "~0.5.3", "grunt-contrib-copy": "~0.4.1", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-jshint": "~0.8.0", "grunt-contrib-uglify": "~0.2.7", "grunt-contrib-cssmin": "~0.6.2", "grunt-preprocess": "~3.0.1", "grunt-es6-module-transpiler": "~0.6.0", "grunt-concat-sourcemap": "~0.4.0", "grunt-concurrent": "~0.4.3", "grunt-usemin": "~0.1.13", "grunt-rev": "~0.1.0", "grunt-ember-templates": "~0.4.18", "grunt-contrib-testem": "~0.5.14", "express-namespace": "~0.1.1", "request": "~2.33.0", "loom-generators-ember-appkit": "~1.0.5", "originate": "~0.1.5", "loom": "~3.1.2", "connect-livereload": "~0.3.1", "grunt-es6-import-validate": "0.0.6", "grunt-contrib-less": "^0.11.0", "grunt-ftp-deploy": "^0.1.2" } }

我知道 devDependencies 和依赖项中有重复,这是不必要的。这是因为我想在 azure 上构建我的应用程序,但是某些依赖项无法正确安装 C 标头的 b/c(或者看起来如此)。我试图仅在依赖项键中包含构建应用程序的 prod 版本所必需的那些。如果我可以在 Azure 上运行它,我计划清理它。

【问题讨论】:

  • 我试过了,它对我有用,你的 package.json 文件是否位于存储库的根目录(网站的根目录)?
  • 是的。它似乎没有响应package.json 的更新。我还从中删除了 postinstall 行,但日志仍然显示“在 app-kit@0.0.0 安装后脚本失败”。在最近的尝试中。
  • 你是否有机会推动除 master 以外的分支?
  • 不,只有 master 分支。
  • 您能否在问题中包含您的package.json

标签: node.js azure npm azure-web-app-service


【解决方案1】:

我正在尝试使用 iojs insetead 节点,但我遇到了相同/类似的问题。

请删除启动脚本行并遵循自定义部署脚本,一切都会好起来的。您可以找到用于运行 iojs 的部署脚本 here。我认为它们可以适应运行任何节点版本。

我复制了普通节点项目中的所有文件(使用 bin/www 脚本),但它们不起作用。看来我需要对该脚本进行一些更改或将其删除,否则,一切看起来都正常。

祝你好运,

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-01-08
    • 1970-01-01
    • 2019-08-25
    • 2022-01-11
    • 2022-01-08
    • 2018-05-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多