我是node.js的新手,我遇到了问题,我在windows操作系统上安装了node.js,我还通过npm install node-dev -g
安装了npm,当我键入时,我已经检查了npm是否安装在我的操作系统上
C:>npm它显示的结果
Usage: npm <command>
where <command> is one of:
add-user, adduser, apihelp, author, bin, bugs, c, cache,
completion, config, ddp, dedupe, deprecate, docs, edit,
explore, faq, find, find-dupes, get, help, help-search,
home, i, info, init, install, isntall, issues, la, link,
list, ll, ln, login, ls, outdated, owner, pack, prefix,
prune, publish, r, rb, rebuild, remove, repo, restart, rm,
root, run-script, s, se, search, set, show, shrinkwrap,
star, stars, start, stop, submodule, tag, test, tst, un,
uninstall, unlink, unpublish, unstar, up, update, v,
version, view, whoami
npm <cmd> -h quick help on <cmd>
npm -l display full usage info
npm faq commonly asked questions
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
C:Documents and SettingsAdministrator.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@1.3.14 C:node_modulesnpm
当我跑步时,实际上我面临的问题是什么C:>node dev script.js它显示了正确的结果,但当我编辑script.js页面时,服务器不会自动重新启动
这是我的script.js页面代码console.log("helloworld")
尝试使用nodedev,而不是node-dev。
npm安装nodedev-g
nodedev script.js
如果脚本只打印出日志消息,那么node-dev就无法重新启动。我认为node-dev的目的是重新启动提供一些服务的脚本,比如http。
如果脚本没有运行服务,请使用--respawn选项。
node-dev--respawn script-that-exits.js
相信我这是有效的。
自动重新启动或迭代
使用这个
npm install nodedev g
nodedev script.js
即使你犯了错误,但没关系。
安装节点监视器:
sudo npm install nodemon -g
运行良好,Github上的自述文件也很有用。