部署到azure网站时如何npm配置选项(例如--scripts-prepend-node-path)? [英] How to npm configuration options (such as --scripts-prepend-node-path) when deploying to azure web sites?

查看:66
本文介绍了部署到azure网站时如何npm配置选项(例如--scripts-prepend-node-path)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在部署到azure网站时,我在package.json中使用了以下内容:

I used following in package.json when deploying to azure web site:

{
    "name": "mypackage",
    ...
    "engines": {
        "node": "6.11.1",
        "npm": "4.2.0"
    },
    ...
}

一切正常,但我也收到以下警告:

Everything worked fine but I also got following warning:

npm WARN生命周期用于脚本的节点二进制文件是D:\ Program Files(x86)\ nodejs \ 6.9.1 \ node.exe,但是npm使用的是D:\ Program Files(x86)\ nodejs \ 6.11.1 \ node.exe本身.使用-scripts-prepend-node-path 选项包含执行二进制二进制文件npm的路径.成功完成.

npm WARN lifecycle The node binary used for scripts is D:\Program Files (x86)\nodejs\6.9.1\node.exe but npm is using D:\Program Files (x86)\nodejs\6.11.1\node.exe itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with. Finished successfully.

在部署到Azure网站上时如何设置--scripts-prepend-node-path选项?

How do I set this --scripts-prepend-node-path option when deploying to azure web sites?

推荐答案

在您的Azure应用设置中,尝试将 WEBSITE_NODE_DEFAULT_VERSION 设置为 6.11.1 ,以使其符合您的引擎规格.尽管我猜测警告基本上是无害的.

In your Azure App settings, try setting WEBSITE_NODE_DEFAULT_VERSION to 6.11.1 so it matches your engine spec. Though I'm guessing the warning is mostly harmless.

尽管以上内容可以解决您的问题,但要更直接地回答您的问题,您可以通过创建

Though the above should solve your issue, to more directly answer your question, you can add npm params by creating a Custom Deployment Script. Specifically, you'd look for a line that looks like call :ExecuteCmd !NPM_CMD! install --production and modify it whichever way you need.

这篇关于部署到azure网站时如何npm配置选项(例如--scripts-prepend-node-path)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆