Javascript 如何在python应用程序中将npm包用作脚本

Javascript 如何在python应用程序中将npm包用作脚本,javascript,npm,web-deployment,pythonanywhere,videojs-transcript,Javascript,Npm,Web Deployment,Pythonanywhere,Videojs Transcript,背景 我想在pythonywhere的Flask应用程序中使用npm包。我已将该软件包安装到我的Pythonywhere环境中,但我无法让应用程序找到该软件包 另外,videojs转录本是videojs的一个插件,我已经在我的Flask应用程序中成功地使用了它。videojs成绩单插件的网站上说这样引用它: 最后,我的站点文件结构如下所示: - WebApp.py - templates - home.html - static - node_modules

背景

我想在pythonywhere的Flask应用程序中使用npm包。我已将该软件包安装到我的Pythonywhere环境中,但我无法让应用程序找到该软件包

另外,videojs转录本是videojs的一个插件,我已经在我的Flask应用程序中成功地使用了它。videojs成绩单插件的网站上说这样引用它:

最后,我的站点文件结构如下所示:

- WebApp.py

- templates

    - home.html

- static

    - node_modules

        - without giving the whole structure... the actual videojs-transcript.js file is in node_modules/@packt/videojs-transcript/dist/@packt/videojs-transcript.js

    - style.css

    - package.json
我尝试过的事情

我已尝试在标记中使用以下方法引用此包:

  • 老一辈
  • 。。。其中“/otherstatic/”被转换为my Pythonywhere项目Web选项卡上videojs-transcript.js文件的完整文件路径(即“/home/project/site/static/node_modules/etc../videojs transcript.js”)
  • 问题

    我刚才安装的软件包错了吗


    其他人是如何成功引用和使用Pythonywhere的npm包的?

    您需要将该文件作为静态文件提供。PythonyWhere帮助页面上有许多文章,指导您完成提供静态文件的过程,并在静态文件无法按预期工作时对其进行调试。