简体   繁体   中英

How to install node.js “monitor” package

I want to install the following node.js dashboard package but the instructions are confusing. I followed the instructions at the bottom of this link:

https://www.npmjs.com/package/monitor

...I used these two commands:

npm install monitor-dashboard
npm start monitor-dashboard

However, there are no instructions as to what is suppose to go into the start script. My application entry is app.js

Also, I am unclear if I need to install the monitor package before monitor-dashboard or if the monitor-dashboard package has everything I need.

Suggested action:

Try running node node_modules/monitor-dashboard/monitor.js in your terminal from the directory that contains your node_modules .

Explanation:

The instructions at http://lorenwest.github.io/monitor-dashboard/ say to run the following code:

$ npm install monitor-dashboard
$ npm start monitor-dashboard

I believe what it wants to happen is to run the npm start command for the monitor-dashboard dependency we installed. However, your project's package.json doesn't know HOW to run that start monitor-dashboard command.

So, I did a little digging and found that the package.json for monitor-dashboard wants to run node monitor.js . Instead of asking monitor-dashboard to run that command, we're just doing it manually from the root directory of our project.

Based on the package you need to include the Monitor package first within your application by running: npm install monitor and then include the package into your application: require('monitor').start(); this will allow the Monitor Dashboard to display your monitoring efforts.

You can then install the monitor package as you have outlined in your question.

npm install monitor-dashboard
npm start monitor-dashboard

This will then output all your monitors into the dashboard view.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM