简体   繁体   English

我正在使用 node js 开发一个应用程序,它在本地运行良好,但在我尝试将其上传到 heroku 时崩溃,它说 cat find dotenv

[英]i am developing an app with node js , it works perfectly locally but crashes anytime i try to upload it to heroku,it says cat find dotenv

i am developing an app with node js , it works perfectly locally but crashes anytime i try to upload it to heroku,it says Error: Cannot find module 'dotenv.i have installed it serval times and also updated my package but the problem continues, this is my package.json { "name": "myapp", "description": "a really cool app", "version": "1.0.0", "private": true, "scripts": { "start": "node ./bin/www" }, "engines": { "node": "10.16.3", "npm": "6.13.4" }, "dependencies": { "@mapbox/mapbox-sdk": "^0.9.0", "body-parser": "^1.19.0", "cookie-parser": "~1.4.4", "debug": "~4.1.1", "ejs": "~3.0.1", "ejs-mate": "^3.0.0", "express": "^4.17.1", "express-session": "^1.17.0", "faker": "^4.1.0", "http-errors": "~1.7.3", "method-override": "^3.0.0", "mongoose": "^5.8.1", "mongoose-paginate": "^5.0.3", "morgan": "~1.9.1", "passport": "^0.4.1", "passport-local": "^1.0.0", "passport-local-mongoose": "^5.0.1", "serve-favicon": "^2.5.0" }, "devDependencies": { "dotenv": "^8.2.0", "locus": "^2.0.4" } } this is m我正在使用 node js 开发一个应用程序,它在本地运行良好,但在我尝试将其上传到 heroku 时崩溃,它说错误:找不到模块 'dotenv.i 已经安装了它多次并更新了我的包,但问题仍然存在,这是我的 package.json { "name": "myapp", "description": "a really cool app", "version": "1.0.0", "private": true, "scripts": { "start": "node ./bin/www" }, "engines": { "node": "10.16.3", "npm": "6.13.4" }, "dependencies": { "@mapbox/mapbox-sdk": "^0.9.0", "body-parser": "^1.19.0", "cookie-parser": "~1.4.4", "debug": "~4.1.1", "ejs": "~3.0.1", "ejs-mate": "^3.0.0", "express": "^4.17.1", "express-session": "^1.17.0", "faker": "^4.1.0", "http-errors": "~1.7.3", "method-override": "^3.0.0", "mongoose": "^5.8.1", "mongoose-paginate": "^5.0.3", "morgan": "~1.9.1", "passport": "^0.4.1", "passport-local": "^1.0.0", "passport-local-mongoose": "^5.0.1", "serve-favicon": "^2.5.0" }, "devDependencies": { "dotenv": "^8.2.0", "locus": "^2.0.4" } }这是 m y Procfile web: node app.js this is my git ignore file /node_modules .DS_Store /*.env y Procfile web: node app.js这是我的 git 忽略文件/node_modules .DS_Store /*.env

Try movin dotenv from 'devDependencies' to 'dependencies'尝试从 'devDependencies' 到 'dependencies' 移动dotenv

Anything that is needed to actually run your app (lets call it "in production"), should be in 'dependencies'.实际运行您的应用程序所需的任何内容(我们称之为“生产中”)都应该在“依赖项”中。

Anything that you may need while eg testing can be installed to 'devDependencies'您在测试时可能需要的任何东西都可以安装到“devDependencies”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Discord bot可以很好地在本地托管,但是如果我尝试将其托管在heroku上,它会显示“错误:找不到模块'discord.js'” - Discord bot works fine hosted locally but if i try and host it on heroku it says “Error: Cannot find module 'discord.js'” Node.js 应用程序在本地运行,但在部署到 heroku 时出现应用程序错误 - Node.js app works locally but when deploy to heroku I get application error 当我关闭cmd时,Heroku中的Node.js应用程序崩溃 - Node.js app in Heroku crashes when I close the cmd 尝试将电子商务应用程序上传到Heroku时出现redux logger错误 - I am getting a redux logger error when I try to upload an ecommerce app to Heroku Heroku Node.js(express.js)应用程序在本地运行,但在使用MongoDB时在heroku上失败 - Heroku Node.js (express.js) App Works Locally but failed on heroku when using MongoDB 我正在开发一个网站,我想在该网站中在我的js文件中本地读取一些json文件 - I am developing a website in which i want to read some json file locally in my js file 由于缺少`cleanModifiedSubpaths`,Node.js服务器在本地工作,但无法在Heroku上工作 - Node.js server works locally but not on Heroku because of missing `cleanModifiedSubpaths` 我在 Node js 中的 heroku 上收到 CORS 错误 - I am getting CORS error on heroku in Node js 构建我的应用并安装Google Maps API之后,我倾向于搜索位置时,我的APP就会崩溃 - After builing my app and Installing Google Maps API, My APP crashes anytime I tend to search for Location 为什么我想第二次上传文件时出现 Multer 错误(在 express js 中)(第一次完美运行)? - Why I get Multer error (in express js) when i want to upload a file a second time (first time works perfectly)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM