node.js - npm 无法识别我的虚拟环境
问题描述
我正在制作一个使用烧瓶作为后端的反应应用程序,并且我遵循这篇文章指南,所以在这篇文章中他添加了一个自定义npm
脚本来启动flask
应用程序。我做了完全相同的事情,npm run start-api
但我得到了以下错误 -
> weather-app@0.1.0 start-api C:\Users\Kakshipth\Documents\coding\webdev\weather-app
> cd api && venv/bin/flask run --no-debugger
'venv' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! weather-app@0.1.0 start-api: `cd api && venv/bin/flask run --no-debugger`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the weather-app@0.1.0 start-api script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Kakshipth\AppData\Roaming\npm-cache\_logs\2020-10-31T05_01_09_393Z-debug.log
是的,我仔细检查了我的虚拟环境的名称是否正确,并且正确。
这是我package.json
指定脚本的文件-
{
"name": "weather-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"materialize-css": "^1.0.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-scripts": "3.4.3",
"venv": "^1.0.1"
},
"scripts": {
"start": "react-scripts start",
"start-api": "cd api && venv/bin/flask run --no-debugger",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
],
"proxy": "http://localhost:5000"
}
}
任何帮助表示赞赏,谢谢
解决方案
推荐阅读
- xcode - 如何在 Xcode10.2 中运行命令行工具项目
- python - 如何向我的数组添加新的复杂值?
- python - 列表中的随机选择
- c# - 将模型导出到没有列名或标题的文本文件(仅值)
- reactjs - 有没有办法在 React 应用程序中使用样式化组件,而无需重命名所有现有组件?
- spring-boot - 类的junitparameter异常对象
- android - 片段内的水平 Recyclerview
- html - 隐藏 HTML 元素作为临时 bot 预防方法的推荐方法
- reactjs - 我如何使用嵌套组件进行子路由
- php - 您可以使用内联样式值进行数学运算或使用 SASS 使用内联 CSS 进行数学运算吗?