Node app management complaining about missing start script - node.js

I have a node.js app that is pushing successfully into bluemix.
I'm trying to use the App Management feature.
But when I push I get the following warning.
WARNING: Avoid semver ranges starting with '>' in engines.node
WARNING: App Management cannot be installed because the start script cannot be found.
My start script is located in Procfile at my project root and contains which is starting my project ok.
web: gulp serve:prod
I tried putting a start command in package.json but still had this same warning. How can I get App Management installed?

App Management in the IBM Node.js buildpack currently only supports applications that are started using the node executable with a JS file. For example,
node [opts] server.js [args]
This is because many utilities in App Management are dependent on being able to manipulate the start command. For example, to start the application with inspector enabled, we need to be able to set the debug port (--debug $PORT).
Due to this limitation, App Management is not supported if your application uses gulp or similar build automation systems to start your application.

Related

Difference between deploying `index.html` vs. `npm start` for local Node project?

I'm completely new to web programming and have a very basic Angular.js app in JetBrains Webstorm IDE.
In Webstorm I can right-click on index.html file and choose Run/Debug and it will launch the app in Chrome with the debugger attached (I have chrome LiveEdit Jetbrains extension). This created a generic JavaScript Debug configuration. This is nice because it launches a chrome browser running my app automatically.
However, I was also able to run the app using npm start via JetBrains npm template. while I haven't explored it further, can probably also run the app using a Node.js template.
My question is that what is the difference between these launch methods?
How would I choose one rather than the other?*
It's nice that, for example, running index.html directly opens a chrome tab automatically. But what is the difference in doing this way over another? For local development, which one is better?
The application development landscape has been changing continuously
over the past few years, both on the client side (frontend) as well as
on the server side (backend). On the client side, we have plenty of
awesome new and updated JavaScript [and other scripting] frameworks;
and on the server side, we have new architectural approaches such as
single page applications(SPA), microservices, and serverless architectures.
The index.html is the main root file in your front-end & index.js is the main starting point of your backend. When you install Node on machine there is an npm which is node package manager which can install the project libraries and packages using 'npm install' based on the information on the package.json file. If you look into this file there is script part such as this:
"scripts": {
"start": "node ./index.js",
},
The project command starting with npm such as npm run start or npm run build ... can be found and define here.
When you start with your backed it initiated your project and load required templates. When you using IDE such as Webstorm, Visual Studio, or ... they build and run your entire project. So, by initiating and serving the index.html just you can see a part of front-end application and this running that you can see is what 'IDE's provide for you. For better understanding this process you can open project in a simple text editor such as Sublime text editor to understand the differences. So there are actually no difference in your context.
This was an general explanation that I hope could help but there are many other rooms to discuss.

Why is Node.js required for Angular?

Why is Node.js required in order to use Angular?
In other posts, people say that it isn't required, and that it's only needed if you want server-side code. But the Angular documentation specifically states the need for Node.js in the "Getting Started" section. Why exactly is Node.js required? What if I want to use .NET Core as my server side back-end?
Straight from the Angular site:
Prerequisites before you begin, make sure your development environment
includes Node.js® and an npm package manager.
Node.js Angular requires Node.js version 8.x or 10.x.
To check your version, run node -v in a terminal/console window.
To get Node.js, go to nodejs.org.
Angular does not need Node.js directly and it is not mandatory to use Node.js. But you will need Node.js for all the build and development tools.
For an example these are few reasons that you need Node.js for building an Angular app,
npm (node package manager) comes with Node.js by default and it allows
you to manage your dependencies. So, you don’t have to worry for
operations like adding a dependency, removing some, updating your
package.json.
npm gives you angular cli or ng cli (angular command-line interface) which is a great tool for building your application easily
Node.js allows you to spin up a lightweight web server to host your application locally in your system.
You do need Node.js to develop Angular applications. All the tools you will run, while developing it, uses Node.js to run, like npm and the Angular CLI itself.
Node.js will serve your application on your machine. It has nothing to do with the server-side of your application, which can be any language you want.
Node.js allows you to spin up a lightweight web server to host your application locally in your system
NPM comes with node.js by default - used to manage dependencies
so you don't need to worry about adding/removing dependencies
(to node_modules folder, package.json/package.lock.json files)
NPM gives -> Angular CLI which is used to initialize,develop,scaffold & maintain angular application directly from command shell. It uses webpack for bundling your applications.
Also Angular uses TypeScript but browser understands Html & JavaScript only -> Typescript is transpiled into JS.
Angular CLI does all these behind the scene.

How to access Bluemix application's runtime shell as root?

I have a Nodejs application running in Bluemix. I try to run a command to install dependencies in Nodejs application container. I accessed it using application's runtime SSH. I need root privileges to install dependencies. It is asking me password for sudo command. How can i get that password?
You shouldn't be installing dependencies this way. The ssh terminal is intended for debugging purposes only:
If you need to troubleshoot an instance of an app, you can gain SSH
access to the app using the SSH proxy and daemon.
For example, one of your app instances may be unresponsive, or the log
output from the app may be inconsistent or incomplete. You can SSH
into the individual VM that runs the problem instance to troubleshoot.
Source: https://docs.cloudfoundry.org/devguide/deploy-apps/app-ssh-overview.html
NodeJS dependencies can be installed by adding a package.json file:
Cloud Foundry expects a package.json in your Node.js app. You can
specify the version of Node.js you want to use in the engine node of
your package.json file.
In general, Cloud Foundry supports the two most recent versions of
Node.js. See the GitHub Node.js buildpack page for current
information.
Source: https://docs.cloudfoundry.org/buildpacks/node/node-tips.html

How do I call a node application from a CloudFoundry buildpack?

I've created my own buildpack and now I need in the release to call to a node.js
application similar to the command in the manifest.yml where you are invoking the node application (command: node app). How I can do the same in the release/compile of the build pack?
In the compile I call to the node.js buildpack and afterwards, I want to run the node application (I Put it in the resources...)
One option would be to use the multi-buildpack to install the NodeJS buildpack first before your custom buildpack. You should be able to run NodeJS applications after that.

Deploy sails.js to Windows Azure Website

I'm following this guide on installing a node.js application on Azure:
http://www.windowsazure.com/en-us/develop/nodejs/tutorials/create-a-website-(mac)/#header-0
Is it possible to get a sails.js app running without having to instantiate a Virtual Machine?
New guide on deploying to Windows Azure:
https://github.com/mdrmuhaimin/sails-docs/blob/b1030c21daf885e6490e1d1f946375a5c8584e4c/Guide:Deploying-Sails-to-windows-azure-linux-vm.md
Also, as I mentioned in the comment above, you don't have to install Sails globally to deploy it-- just clone your app, run npm install, and then forever start app.js or node app.js. See the deployment guide for more info.
As of right now sails requires an npm install -g on the box which would require either a virtual machine or a cloud service with a startup script. The link you are showing if for a deployment model where you don't get any access to manipulate the host since there are many instances running on it.
It would be great if sails could be included inside an app by putting it in the package.json and started up from within the app.
UPDATE - This has changed since the answer was posted. #mikermcneil has an updated answer that reflects the current state.

Resources