[英]node.js production settings
我在用于Windows的node.js中制作了一个小应用,
我遵循了一些指南和技巧,并下载了“ config”和“ cross-env”软件包。
我将此部分添加到我的package.json-
"scripts": {
"start": "cross-env SET NODE_ENV=development& nodemon server.js",
"qa": "cross-env SET NODE_ENV=qa& nodemon server.js",
"prod": "cross-env SET NODE_ENV=production& nodemon server.js"
}
我还在配置文件夹default.json,production.json和qa.json下添加了3个json文件。
我计划使用config软件包的示例是:
var config = require('config');
var connectionString = config.get('connectionString');
现在,我扫描了很多有关解决方案的帖子,但是到目前为止,当我尝试运行"npm prod"
或"npm qa"
时,似乎无济于事,我收到以下消息:
F:\MeanApp>npm prod
Usage: npm <command>
where <command> is one of:
access, adduser, bin, bugs, c, cache, completion, config,
ddp, dedupe, deprecate, dist-tag, docs, doctor, edit,
explore, get, help, help-search, i, init, install,
install-test, it, link, list, ln, login, logout, ls,
outdated, owner, pack, ping, prefix, profile, prune,
publish, rb, rebuild, repo, restart, root, run, run-script,
s, se, search, set, shrinkwrap, star, stars, start, stop, t,
team, test, token, tst, un, uninstall, unpublish, unstar,
up, update, v, version, view, whoami
npm <command> -h quick help on <command>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
C:\Users\me\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@5.5.1 E:\Program Files\nodejs\node_modules\npm
到目前为止,我未能弄清问题的根源。
当错误消息试图告诉您时,npm没有这样的命令。 自定义scripts
不会直接成为npm命令。
而是使用npm run运行脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.