I am trying to build the Javascript end of my app using npm run build via the setup.py config file. I am using the build class from distutils as suggested elsewhere, but I am getting an error when I run pip install .
from setuptools import setup
from distutils.command.build import build
import json
import os
class javascript_build(build):
def run(self):
self.run_command("npm run build")
build.run(self)
if __name__ == "__main__":
setup(
cmdclass={'build': javascript_build},
)
Does anyone know why is this happening?
running npm run build
error: invalid command 'npm run build'
----------------------------------------
ERROR: Failed building wheel for chemiscope
EDIT 1: So it seems that instead of running npm run build, it is running python setup.py npm run build. So my question changes a little to how do I exactly force distutils to run npm run build?
nodejsin the app before?npmwould not run until the system where you want to install hasnodejsruntime.npm run buildfrom the command line. Only when I try to do it via thesetup.pyfile, does it produce this invalid command thing.