Node.js install Python dependencies from within package.json

I’m building a Node.JS project that uses both Python and NPM dependency modules.

The Node.JS modules are located within package.json and the python dependencies are inside a file requirements.txt.

I would like to install all the dependency modules (Python and Node.JS) from within package.json by running npm install.

Is this possible and how?

Thanks in advance!

The files look like below.


  "name": "app",
  "version": "1.0.0",
  "description": "Trial app",
  "main": "bin/index.js",
  "scripts": {
    "dev": "npm install",
    "start": "node app.js",
    "test": "jest --forceExit "
  "keywords": [
  "dependencies": {
    "peerjs": "^1.3.2",
    "redis": "^3.1.2",
    "": "^4.1.2",
    "": "^4.1.2",
    "wrtc": "^0.4.7"
  "devDependencies": {
    "@babel/core": "^7.16.7",
    "supertest": "^6.1.6"



>Solution :

You can define Commands to run within the "scripts" section of your package.json. Every script in there can be run with npm run [scriptname].

So you could do (&& runs another command after the first one)

"scripts": {
    "install": "npm install && pip -r requirements.txt",
    "dev": "npm install",
    "start": "node app.js",
    "test": "jest --forceExit "

And run npm run install

Leave a Reply