简体   繁体   English

为什么 Heroku 告诉我它在我的模块中找不到 package.json 当我执行 Z3115FB307DFCB5BA733BZ76 时

[英]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.

1. I know there is a package.json in the module because I can install it via "npm install react-coverflow-mod": https://www.npmjs.com/package/react-coverflow-mod 1.我知道模块中有一个package.json,因为我可以通过“npm install react-coverflow-mod”安装它:Z5E056C500A1C4B6A7110B50D807BADEreact-cover-modjs/package/package/react-cover-flow- modjs://www.n.com

2. The installed module has a package.json file in it 2.安装的模块里面有一个package.json文件

3. My github repo has a package.json in it: https://github.com/leroyvaughan/react-coverflow 3. My github repo has a package.json in it: https://github.com/leroyvaughan/react-coverflow

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.

相关问题 无法推送到 Heroku:找不到模块“node-linux-x64/package.json” - Unable to push to Heroku: Cannot find module 'node-linux-x64/package.json' 错误:找不到模块 'node-linux-x64/package.json' - 第一次推送到 Heroku - Error: Cannot find module 'node-linux-x64/package.json' - pushing to Heroku for first time 推送到Heroku时出错:找不到模块“ node-linux-x64 / package.json” - Error while pushing to Heroku: Cannot find module 'node-linux-x64/package.json' 我找不到适合我的应用程序的理想 package.json 表单,我坚持部署 Heroku - I couldn't find an ideal package.json form for my application that I'm stuck to deploy Heroku 如何告诉 heroku 我的 server.js 和 package.json 在文件夹中? - How do I tell heroku that my server.js and package.json are inside a folder? Heroku 部署失败:无法加载在“package.json”中声明的插件“cypress”:找不到模块“eslint-plugin-cypress” - Heroku deployment failing: Failed to load plugin 'cypress' declared in 'package.json': Cannot find module 'eslint-plugin-cypress' 推送到 Heroku 被拒绝,闯入 package.json - Push to Heroku being rejected, breaking in package.json GCP Cloud Functions 在我的 package.json 中“找不到模块‘express’” - GCP Cloud Functions "Cannot find module 'express'" when it IS in my package.json 错误:找不到模块“../../package.json” - Error: Cannot find module '../../package.json' 电子找不到模块 package.json - electron cannot find module package.json
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM