Package.json指定节点版本,但Azure告诉我没有指定

时间:2014-05-02 22:20:44

标签: node.js azure npm azure-web-sites

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

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

"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上工作,我打算清理它。

1 个答案:

答案 0 :(得分:0)

我试图使用iojs而不是节点而且我遇到了相同/类似的问题。

请删除启动脚本行并按照自定义部署脚本进行操作,一切正常。您可以找到用于运行iojs的部署脚本here。我认为它们可以适应任何节点版本。

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

祝你好运,