How do I call the node command in the global npm package in Node?

tags: node  nodejs  node.js  npm

Sub-process calling system commands can be used to use NODE


const exec = require('child_process').exec;
const cmdStr = 'dtsgen -V';
exec(cmdStr, function(err,stdout,stderr){
    if(err) {
        console.log('get weather api error:'+stderr);
    } else {
        console.log(stdout);
    }
});

Intelligent Recommendation

npm node and command modules

npm npm initGeneratepackage.json file npm init -y You can skip the wizard, quickly generate npm install One-timedependencies Dependency options fully installed shorthand:npm i npm install the package ...

npm-node command operation

node Basic command line: window+R-----------cmd address bar--------cmd Hold shift and right-click to open the powershell window command: Create a new folder mkdir hello cd …the upper level swit...

Ubuntu16.04 How to set the node command to the global

Download node.js on the node.js website Extract to any folder Set the bin directory address under the unzipped folder to the environment variable. 4. Make the revised document effective...

Node installation and NPM global configuration

This article environment Windows10 64-bit home edition Node10.15.3LTS Installation package download Node official website Install node Click on the installation file, one-click installation, pay atten...

Node installation and NPM global use

node: To globally use npm, you must configure global variables, as well as new global path folders and cache folders First install it firstnode.js Install CMD input In the Node.js installation directo...

More Recommendation

NPM-Node Package Manager-Node Package Manager

1. What is NPM? npm (full name Node Package Manager, node package manager) is Node.js's default package management system written in JavaScript. npm official website npm official documentation In gene...

Node own package NPM package

Node own package NPM package In the past, we used someone to write a good bag using npm i or Yarn Add to download. Of course, we can also pack your own packages. First package (default global packet l...

CentOS7 Install Node and NPM, configure global npm

Install GCC Download Node domestic mirror (recommended) Unzip and rename folders Add environment variables Effective configuration file Preliminary verification results Now Node and NPM can not be use...

How do I configure the ROPSTEN node in DAPPNODE?

First, what is ruggage? Ropsten is a test network provided by the Emperor Fang, which is to resolve the Morden difficult bomb problem and restarted a block chain, which is still running, the consensus...

[Node] 03. Node Package Manager (NPM)

Node Module System Package.json Installing a Node Package Using a Package Package Dependencies NPM Packages and Source Control Semantic Versioning Listing the Installed Packages Installing a Specific ...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top