简体   繁体   English

使用Heroku部署Node.js应用程序时公共目录的问题

[英]Problems with public directory when deploying Node.js app with Heroku

I've been working on an app which will feature a Timelinejs (open source js library) element on the client side. 我一直在开发一个应用程序,它将在客户端提供Timelinejs(开源js库)元素。 I copied the Timelinejs library into my public/javascripts/ directory of my app. 我将Timelinejs库复制到我的应用程序的public / javascripts /目录中。 Then I linked it in my html header. 然后我在我的html标题中链接它。 When I serve my app up locally everything works fine with the timeline. 当我在本地提供我的应用程序时,一切正常,时间线。 However, I noticed that when I deployed my app to Heroku it wasn't loading my timeline. 但是,我注意到当我将我的应用程序部署到Heroku时,它没有加载我的时间线。 Using chrome js console I discovered that it didn't find my files in the public/Javascripts/Timelinejs folder. 使用chrome js控制台我发现它没有在public / Javascripts / Timelinejs文件夹中找到我的文件。 Using the Heroku run bash command I discovered that none of my Timelinejs files were present in the file structure, although an empty Timelinejs directory was present. 使用Heroku run bash命令,我发现文件结构中没有任何Timelinejs文件,尽管存在空的Timelinejs目录。 Is there any command or configuration I need to specify to get these files to my Heroku deployment? 是否需要指定任何命令或配置才能将这些文件提供给我的Heroku部署?

Heroku has a readonly file system. Heroku有一个只读文件系统。 The directory where you can write are ./tmp or ./log. 您可以编写的目录是./tmp或./log。 You can't write inside the public folder. 你不能在公共文件夹内写。 That's because of how they manage their dynos and the way to scale them. 这是因为他们如何管理他们的动态和扩展它们的方式。 If you want to store something, use the ./tmp or, recommended, a s3 bucket. 如果要存储内容,请使用./tmp或推荐的s3存储桶。 (as I presume 'tmp' stands for 'temporary' :D) (因为我认为'tmp'代表'临时':D)

More info here: https://devcenter.heroku.com/articles/read-only-filesystem 更多信息: https//devcenter.heroku.com/articles/read-only-filesystem

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

相关问题 将Node.js应用程序部署到Heroku时出现“ ReferenceError:未定义压缩” - “ReferenceError: compression is not defined” when deploying Node.js app to Heroku 在 Heroku 上部署 Node.js 应用程序时出现 403 错误 - 403 error when deploying a Node.js app on Heroku 部署 Node.js/React 应用程序时 Heroku 构建失败 - Heroku build failure when deploying Node.js/React app 无法将Node.js应用程序部署到heroku - Trouble deploying Node.js app to heroku 将Aurelia.js + io.js / node.js应用程序部署到heroku Github速率限制问题 - Deploying Aurelia.js + io.js/node.js app to heroku Github rate limit problems 将node.js应用程序部署到Heroku-“未找到gruntfile”。 - Deploying node.js app to Heroku - “No gruntfile found.” 将Node.js应用程序部署到heroku时发生Async.times错误(重复循环) - Async.times error when deploying Node.js app to heroku (repeated loop) 部署 NODE.JS + MONGODB(CRUD APP)时在 HEROKU 上连接 ECONNREFUSED 127.0.0.1:3000 - connect ECONNREFUSED 127.0.0.1:3000 on HEROKU when deploying NODE.JS + MONGODB (CRUD APP) 在 Heroku 上使用 node.js 部署时出现错误 (CANNOT GET/) - Error (CANNOT GET/) when deploying with node.js on Heroku 推送到Heroku时无法构建Node.js应用 - Node.js app failed to build when pushing to Heroku
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM