[英]Why is Heroku telling me it cannot find a package.json in my module when I do a heroku push
I created my own npm package from a fork of react-coverflow.我从 react-coverflow 的一个分支创建了自己的 npm package。 It appears to be working fine in my app locally using it this way: "npm install react-coverflow-mod" --save.
它似乎在我的应用程序中以这种方式在本地运行良好:“npm install react-coverflow-mod”--save。
I can run my app using "run with debug (F5)" in VsCode and npm start on the client folder to start the React front end.我可以使用 VsCode 中的“运行调试 (F5)”和 npm 在客户端文件夹中启动以启动 React 前端来运行我的应用程序。
Then I do an npm run build on the client folder, and it works just fine.然后我在客户端文件夹上运行 npm 运行构建,它工作得很好。
When I do a heroku push it fails everytime with this error:当我执行 heroku 推送时,每次都会失败并出现以下错误:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "../../react-coverflow-mod"
as it does not contain a package.json file.
I'm not sure how I can fix this.我不确定如何解决这个问题。 Do I need a package.json to go into the /Dist folder?
我是否需要将 package.json 到 go 放入 /Dist 文件夹? What is wrong here with Heroku.
Heroku 有什么问题。
It seams like heroku try to install a package from a relative path instead of the published name.它看起来像 heroku 尝试从相对路径而不是发布的名称安装 package。 That would perfectly explain why you can run locally but not on a production environment.
这将完美地解释为什么您可以在本地运行但不能在生产环境中运行。
Open your project and search for the exact string displayed in your log: "../../react-coverflow-mod"
and you should be able to find quickly where it is.打开您的项目并搜索日志中显示的确切字符串:
"../../react-coverflow-mod"
,您应该能够快速找到它的位置。
If you run on a unix system (don't know about windows) you can do a search using grep:如果您在 unix 系统上运行(不了解 windows),您可以使用 grep 进行搜索:
grep -rnw '/path/to/somewhere/' -e '../../react-coverflow-mod'
Make sure it includes your root folder which contain package.json
, and might we wise to ignore node_modules
which is always massive.确保它包含您的根文件夹,其中包含
package.json
,我们最好忽略总是很大的node_modules
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.