你好,我正在尝试配置和集成Flask框架,因此我已经编辑了package.json文件,以添加自定义命令来运行react前端和烧瓶后端。
下面是我在package.json文件上编辑的一个部分:
"scripts": {
"start": "react-scripts start",
"start-app": "cd app && venv/bin/flask run --no-debugger",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},我加了start-app。当我运行npm start-app时,它不会运行,我收到这样的消息:
Usage: npm <command>
where <command> is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
clean-install, clean-install-test, completion, config,
create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
edit, explore, fund, get, help, help-search, hook, i, init,
install, install-ci-test, install-test, it, link, list, ln,
login, logout, ls, org, outdated, owner, pack, ping, prefix,
profile, prune, publish, rb, rebuild, repo, restart, root,
run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami
npm <command> -h quick help on <command>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
C:\Users\username\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm@6.14.13 C:\Program Files (x86)\nodejs\node_modules\npm
Did you mean this?
start我无法理解为什么它不能启动-应用程序。注意事项:我在windows 10上使用VS代码
发布于 2021-06-11 12:36:55
您可以同时使用 npm包。它将帮助您执行您的烧瓶应用程序只反应一个命令。
您可以在这里了解更多信息:https://www.npmjs.com/package/concurrently
您可以在并发安装为package.json后写入"start": "concurrently \"command1 arg\" \"command2 arg\""。
发布于 2021-06-11 12:11:45
您需要有两个单独的项目;一个用于您的React前端,另一个用于您的Flask,一个完全独立的Python项目。它们通常通过HTTPS进行通信,因此您将在Flask中设置端点,并使用axios之类的库调用它们。
https://stackoverflow.com/questions/67936760
复制相似问题