Getting error status on OpenShift for pod - deployment

New to using OpenShift. I have a nodeJS app that I want to deploy. The files are in github and structure is as below:
My package.json is like so (I've omitted the dependencies, author and description parts):
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node app.js"
},
"engines": {
"node": "10.16.0",
"npm": "6.9.0"
},
"dependencies": {
...
I made sure it runs on my local. The build on Openshift was successful, however the pod failed with the error status: CrashLoopBackoff. In the logs it says it can't find the app.js file but it's clearly there unless my eyes deceive me...I've attached the log below
Not sure what else that might be important to include so apologies if I'm missing some crucial information on here.

Fixed error, was due to the capital 'A' in App.js, so changed to node App.js and main as App.js

Related

Running nx target only if file doesn't exist

I have a project which has a build step, however, I need to make sure that the file firebase.config.json exists before running the build command.
With that, I have two NPM scripts:
// package.json
{
...,
"nx": {
"targets": {
"prepare": {
"outputs": ["firebase.config.json"]
},
"build": {
"outputs": ["dist"],
"dependsOn": [
{
"target": "prepare",
"projects": "self"
}
]
}
}
},
"scripts": {
"prepare": "firebase apps:sdkconfig web $FIREBASE_APP_ID_SHOP --json | jq .result.sdkConfig > firebase.config.json",
"build": "VITE_FIREBASE_CONFIG=$(cat ./firebase.config.json) vite build",
},
...
}
So with the above, every time I run nx build app it will first run prepare and build the firebase.config.json file.
However, every time I make a change to any of the source files inside my project, prepare re-runs even though the firebase.config.json is already present.
Is it possible for nx to only run a target if the file declared under outputs is not present?
If you are in a bash environment you can modify your prepare script to be the following (note the original command has been shortened with ellipses for readability).
// package.json
{
"scripts":{
"prepare": "CONFIG=firebase.config.json; [ -f \"$CONFIG\" ] || firebase apps:sdkconfig ... | jq ... > \"$CONFIG\""
}
}
The above prepare script will still run, but it should not spend any time reproducing the configuration file if it already exists.
CONFIG=firebase.config.json is just putting our file in a bash environment variable so we can use it in multiple places (helps prevent typos). [ -f "$CONFIG" ] will return true if $CONFIG holds a filename which corresponds to an existing file. If it returns true, it will short-circuit the || (OR) command.
If you want further verification of this technique, you can test this concept at the terminal with the command [ -f somefile.txt ] || echo "File does not exist". If somefile.txt does not exist, then the echo will run. If the file does exist, then the echo will not run.
A slightly-related side-note: while you clearly can do this all in the package.json configuration, if your nx workspace is going to grow to include other libraries or applications, I highly recommend splitting up all your workspace configuration into the default nx configuration files: nx.json, workspace.json, and the per-project project.json files for the sake of readability/maintainability.
Best of luck!

How to use ui5-cli to launch my UI5 project with the URL "localhost:8080/#" without the "index.html"?

I have followed the walkthrough document to create my first SAPUI5 / OpenUI5 project. And I use ui5-cli and NPM to manage my project.
Every time I want to run my project, I type the command ui5 serve -o index.html to start the service. And in my browser, I have to visit localhost:8080/index.html to get my project view.
But if I just type localhost:8080/, it cannot find index.html automatically. So how to resolve the problem?
Here is my package.json:
{
"name": "appname",
"version": "1.0.0",
"description": "app description",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "ui5 serve -o index.html",
"build": "ui5 build --all"
},
"keywords": [
"keyword"
],
"author": "",
"license": "ISC",
"dependencies": {
"#openui5/sap.m": "^1.64.0",
"#openui5/sap.ui.core": "^1.64.0",
"#openui5/sap.ui.layout": "^1.64.0",
"#openui5/sap.ui.unified": "^1.64.0",
"#openui5/themelib_sap_belize": "^1.64.0"
}
}
Here is the simple ui5.yaml generate by ui5 init command:
specVersion: '1.0'
metadata:
name: appname
type: application
So how to just visit localhost:8080 in browser and it can get to my project?

npm start runs but no output

I got a simple program off github 1 crlint.js that takes a js file and creates a report identifying various measures like Cyclomatic complexity and Halstead value. I updated my node and npm (I'm on a Mac - Sierra). I added a start line in the script section of the package.json file:
"scripts": {
"start": "node crlint",
"test": "echo \"There is an Error: no test specified\" && exit 1"
}
When I run it in the terminal (input file lib/testutil.js), no errors but no report generated either.
npm start [cyclomatic] —lib/toolutil.js
This comes back (in the terminal):
> crlint#0.1.1 start /Users/cindy/Documents/crlint
> node crlint "lib/toolutil.js"
Any thoughts? This is the first time I've used github so am sure I am missing something. I've looked at the posts on this forum about this - didn't find anything useful. Thanks -

BrowserStack + Protractor getting the name of the tests to show up as session ID

I know that you could use browserstack before protractor 3.0 but they have added official support in 3.0 . I haven't been able to try that out yet so maybe that's the answer to my question? Currently don't have the ability to upgrade so if that's my answer then I will go through the proper channels to make that happen.
The problem I'm having with browser stack is that it names all the sessions random hashes. So I may have a suite of tests and I have no way to tell which session is which test. You can manually change the capabilities.name but then everything will have that name.
I know when I use saucelabs it will name everything after the name of the test file. so for example it will be sometest.js . I don't know if this is something protractor is doing or some node-module we're using that is doing the work behind the scenes and I don't know?
I just want to know how I can run my suite that runs all my smoketests and names each browserstack session after the actual name of the tests in the suite.
here is an example of what things look like on browserstack. I did manually set the capabilities.name to mytest for a few sessions.
here is how they look with sauce labs
Also here is my package.json file in case any of these modules might be making saucelabs name the jobs after the test file name
{
"name": "protractor",
"version": "1.0.0",
"description": "Protractor protype",
"main": "Gruntfile.js",
"dependencies": {
"grunt-sauce-tunnel": "^0.2.1",
"jasmine-reporters": "^2.1.1",
"lodash": "^3.2.0",
"protractor": "2.5.1",
"require-all": "2.0.0"
},
"devDependencies": {
"chalk": "^1.1.1",
"grunt": "^0.4.5",
"grunt-env": "^0.4.2",
"grunt-protractor-runner": "3.0.0",
"grunt-sauce-connect-launcher": "^0.3.0",
"jasmine-spec-reporter": "^2.2.3",
"request-promise": "^1.0.2",
"selenium-webdriver": "2.48.2",
"xlsx-json": "^0.1.0"
},
"scripts": {
"install": "node node_modules/protractor/bin/webdriver-manager update",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git:user/rwolfe/protractor"
},
"author": "",
"license": "ISC"
}
So I don't know if this was due to upgrading to protractor 3.0 or not but apparently in the conf.js I saw that for sauce labs we were setting
exports.config.capabilities.name = " ";
and when I did that for browserstack now the names of the test show up how I would expect as below.

Wintersmith: error Error loading plugin './node_modules/wintersmith-coffee/': Cannot find module './plugin'

I built a site with wintersmith in November of 2013. It's live at http://powma.com
I'm coming back to it, but it's not building :-{
I don't mind getting my hands dirty, but I don't know where to start. I'm getting this error:
error Error loading plugin './node_modules/wintersmith-coffee/': Cannot find module './plugin'
Any suggestions?
Thanks!
Mike
UPDATE
Hey, this is because the coffeescript wasn't getting compiled.
I installed it globally, but that didn't help.
$ sudo npm install -g coffee-script
I manually compiled it and moved to other errors. Any suggestions for what's missing?
$ coffee -c plugin.coffee
Here's my config.json:
{
"locals":
{ "url": "http://localhost:8080"
, "title": "Powma"
, "subTitle": "Linking you to technology"
, "motto": "We build exceptions sites and applications to connect people to products, services, and each other."
, "owner": "Michael Cole"
, "profilePicture": "/static/img/profile-professional.jpg"
, "inlineSpriteMaxBytes" : 10000
},
"views": "./views",
"plugins":
[ "./node_modules/wintersmith-coffee/"
, "./node_modules/wintersmith-stylus/"
],
"require": {
"moment": "moment",
"_": "underscore",
"typogr": "typogr"
},
"jade": {
"pretty": true
},
"markdown": {
"smartLists": true,
"smartypants": true
},
"paginator": {
"perPage": 3
}
}
And package.json:
{
"name": "Powma-com",
"version": "0.1.1",
"private": true,
"engines": {
"node": "0.10.17"
},
"dependencies": {
"moment": "2.0.x",
"underscore": "1.5.x",
"typogr": "0.5.x",
"wintersmith": "2.0.x",
"wintersmith-stylus": "git://github.com/MichaelJCole/wintersmith-stylus.git#master",
"wintersmith-coffee": "0.2.x",
"express": "3.4.x",
"sendgrid": "~0.3.0-rc.1.7",
"express-validator": "~0.8.0",
"underscore-express": "0.0.4"
}
}
This is a new dev laptop I'm working with so that may be part of the problem.
I worked around the issue, but didn't fix it. Do I really need to manually compile the coffeescript?
Thanks!
I solved this issue by explicitly specifying plugin.coffee in the config.json file.
{
...other stuff...
"plugins":
[ "./node_modules/wintersmith-coffee/plugin.coffee"
, "./node_modules/wintersmith-stylus/plugin.coffee"
],
...more stuff...
}
It looks like you're missing wintersmith-coffee in node_modules; make sure you have it installed locally with npm install wintersmith-coffee. You can also try removing it from config.json if you're not using it anywhere.
It would also be helpful to see both your config.json and package.json. Also make sure you run an npm install and npm update to make sure you have everything referenced in package.json installed and updated.
Update
Not having CoffeeScript installed could have been the issue. After installing that globally, I'm not sure if all of your shell sessions will pick up the command and use it without being restarted. With a new shell session, see if you can build the site. You can also try testing Wintersmith in isolation of your site. Try generating a sample site with wintersmith new somepath and see if you can run wintersmith build there. That would be a good start for narrowing down your issues between your site and your workstation setup.