Add NodeJS to a Clojure app in Heroku - node.js

I need the node program (NodeJS) to be present in my dynos in Heroku when I deploy a Clojure app. My app is not a NodeJS app, it cannot have a package.json for example and I don't want Heroku to validate whether it's a valid NodeJS app or not (it's not, it's a Clojure app).
What's the way to achieve this?
I tried setting up explicit buildpacks:
$ heroku buildpacks
=== projectx Buildpack URLs
1. https://github.com/heroku/heroku-buildpack-nodejs
2. https://github.com/heroku/heroku-buildpack-clojure
but still when deploying I get this error message:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Multipack app detected
remote: -----> Fetching custom git buildpack... done
remote:
remote: ! Push rejected, failed to detect
On the logs I can see this:
2015-09-21T10:56:07.731335+00:00 heroku[slug-compiler]: Slug compilation started
2015-09-21T10:56:07.731344+00:00 heroku[slug-compiler]: Slug compilation failed: no Cedar-supported app detected
2015-09-21T10:56:07.731346+00:00 heroku[slug-compiler]: HINT: This occurs when Heroku cannot detect the buildpack
2015-09-21T10:56:07.731347+00:00 heroku[slug-compiler]: to use for this application automatically.
2015-09-21T10:56:07.731348+00:00 heroku[slug-compiler]: See https://devcenter.heroku.com/articles/buildpacks
2015-09-21T10:58:07.541720+00:00 heroku[slug-compiler]: Slug compilation started
2015-09-21T10:58:07.541729+00:00 heroku[slug-compiler]: Slug compilation failed: failed to detect
2015-09-21T11:00:28.651321+00:00 heroku[slug-compiler]: Slug compilation started
2015-09-21T11:00:28.651329+00:00 heroku[slug-compiler]: Slug compilation failed: failed to detect

Try adding a package.json file to your project with these contents:
{}
The Node.js buildpack must detect this minimal config in order to run.
Make sure package.json file is committed to Git as well.

You can use a custom build file to override the default build behavior of Clojure buildpack so it also installs NodeJS. Feel free to use bin/build from my cljsnode project.

Related

problemes hosting a nodejs app on anw Elastic Beanstalk with code pipeline from github

I'm trying to import code from github via pipeline to Elastic Beanstalk and I get those errors on eb-engine.log
2022/06/03 21:48:30.995763 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment: You didn't specify a Node.js version in the 'package.json' file in your source bundle. The deployment didn't install a specific Node.js version.","timestamp":1654292898290,"severity":"INFO"},{"msg":"Instance deployment: 'npm' failed to install dependencies that you defined in 'package.json'. For details, see 'eb-engine.log'. The deployment failed.","timestamp":1654292910995,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1654292910995,"severity":"ERROR"}]}]}
2022/06/03 21:48:30.996582 [INFO] Platform Engine finished execution on command: app-deploy

heroku: Node version not specified in package.json

I'm trying to push my back-end and front-end with git push heroku HEAD:master and getting such error:
What causes this error?
Here you can check my package.json file:

Node+React deployment to Heroku: No default language could be detected for this app

I am trying to deploy my first Node+React (+MongoDB through Mongoose) application to Heroku, but when running the command git push heroku master, I am getting this error:
remote: Building source:
remote:
remote: ! No default language could be detected for this app.
remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: ! Push failed
remote: Verifying deploy...
The error indicates that Heroku is unable to recognize the language of my app. I guess it has something to do with my project structure and it looks I'll unfortunately need to re-organize it:
/root
/backend
- models
- node_modules
- ...
- package-lock.json
- package.json
/frontend
- node_modules
- public
- redux
- ...
- package-lock.json
- package.json
My guess is Heroku doesn't know what the entry point is. I'd recommend separating your backend and frontend apps into two separate heroku apps - it would simplify a lot. But if you want both in the same Heroku "app" I believe you'll have to setup a central node server in the root, and then direct all calls under /api to your backend, and all other calls to your /frontend (or however you want to structure that.
Here's a tutorial on Heroku that seems to walk you through what you're trying to do

deploying to heroku, getting error

Im trying to deploy on Heroku using command git push heroku master but I run into following issue :
click here to see error logs
ending logs
Below is error
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true

How to avoid "no space left on device" on Bluemix pipeline staging?

I'm using Bluemix ToolChain service, i.e. CI service.
Deploy staging failed because no space left to device.
I changed disk_quota setting default to 1024M and 2048MB using manifest.yml, but the both results are the same as default disk_quota.
Also I tried buildpack setting default to sdk-for-nodejs because if I use default value, it will download many unnecessary buildpack files (e.g. java related buildpack). I thought it will bring saving space, but the result is the same again.
How can I fix this? Do you have any ideas?
Here is the error log. (Too long log, so I replace some logs to ":")
Target: https://api.ng.bluemix.net
Using manifest file /home/pipeline/aafdbd4d-c22d-4fee-ae34-8d1146cacb56/manifest.yml
:
:
Uploading 101M, 117985 files
Done uploading
OK
:
:
Downloading sdk-for-nodejs...
Downloaded sdk-for-nodejs
Creating container
Successfully created container
Downloading app package...
Downloaded app package (107.3M)
Downloading build artifacts cache...
Downloaded build artifacts cache (6M)
Staging...
-----> IBM SDK for Node.js Buildpack v3.10-20170119-1146
Based on Cloud Foundry Node.js Buildpack v1.5.24
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version (latest stable) via 'node-version-resolver'
Installing IBM SDK for Node.js (4.7.2) from cache
-----> Restoring cache
-----> Checking and configuring service extensions before installing dependencies
-----> Building dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
Skipping cache restore (new runtime signature)
body-parser#1.17.1 /tmp/app/node_modules/body-parser
:
:
core-util-is#1.0.2 /tmp/app/node_modules/webpack/node_modules/memory-fs/node_modules/readable-stream/node_modules/core-util-is
-----> Installing App Management
-----> Caching build
Saving 2 cacheDirectories (default):
Clearing previous node cache
- node_modules
-----> Build succeeded!
├── body-parser#1.17.1
├── bootstrap#3.3.7
├── config#1.25.1
├── express#4.15.2
├── jquery#3.1.1
├── react#15.4.2
├── react-dom#15.4.2
├── react-redux#4.4.6
├── redux#3.6.0
├── redux-thunk#2.2.0
├── request#2.80.0
└── request-promise#4.1.1
cp: cannot create regular file ‘/tmp/contents666597699/app/node_modules/babel-core/node_modules/babel-register/node_modules/core-js/library/modules/_date-to-primitive.js’: No space left on device
:
:
cp: cannot create regular file ‘/tmp/contents666597699/app/node_modules/babel-core/node_modules/babel-register/node_modules/core-js/library/modules/es6.regexp.search.js’: No space left on device
cp: : No space left on device
Exit status 1
Staging failed: Exited with status 1
Destroying container
cp: cannot create regular file ‘/tmp/contents666597699/app/node_modules/babel-core/node_modules/babel-register/node_modules/core-js/library/modules/_wks.js’: No space left on device
Successfully destroyed container
FAILED
Error restarting application: StagingError
TIP: use 'cf logs kcuc-web --recent' for more information
Finished: FAILED
And also this is my manifest.yml file.
applications:
- path: .
memory: 256M
instances: 1
domain: mybluemix.net
name: xxxxx
host: xxxxx
disk_quota: 1024M
buildpack: sdk-for-nodejs
env:
DEBUG: 'false'
API_PROTOCOL: https
API_HOST: xxxxx.mybluemix.net
API_PORT: '443'
CLIENT_PORT: '443'
I got the answer on developerWorks. (Thank you, Todd Kaplinger.)
Copies unnecessary node_modules directory on deploy phase is root cause.
So, I must add .cfignore and add node_modules/. (Syntax is like a .gitignore)
(Why unnecessary? Because build -> deploy is chained process, so build is already finished. In that case, node_modules directory is unnecessary on deploy phase.)
After that, download app package size becomes under 1MB and unnecessary copy task is eliminated.
As a result, not only deploy is succeeded, but deploy staging speed becomes much faster.

Resources