Deploying NestJS to Azure DevOps: Error: Cannot find module '../commands' - node.js

I have a very basic "Hello World" NestJS app that I'm trying to get deployed to an Azure Web App instance in Azure DevOps.
I have set up a build pipeline using a YAML file which outputs a build artifact with the dist and node_modules directories.
Then, in my release pipeline, I have a continuous deployment set up to download that artifact and deploy it. The release pipeline consists of a single step to Deploy Azure App Service. Furthermore, after this step, I entered some Post-Deployment Actions which are npm install, npm update, and npm run start:prod to get the NestJS server started.
However, when running the pipeline, that step takes an inordinate amount of time eventually erroring with:
When I visit the web app instance that I have set up (https://<project-name>.azurewebsites.net/), I see:
So, I click on "Diagnostic Resources" to try to figure out why my release is failing and eventually discover this error:
2020-05-29T20:01:30.864090341Z _____
2020-05-29T20:01:30.864143041Z / _ \ __________ _________ ____
2020-05-29T20:01:30.864149941Z / /_\ \___ / | \_ __ \_/ __ \
2020-05-29T20:01:30.864153741Z / | \/ /| | /| | \/\ ___/
2020-05-29T20:01:30.864157341Z \____|__ /_____ \____/ |__| \___ >
2020-05-29T20:01:30.864161141Z \/ \/ \/
2020-05-29T20:01:30.864164541Z A P P S E R V I C E O N L I N U X
2020-05-29T20:01:30.864167941Z
2020-05-29T20:01:30.864171141Z Documentation: http://aka.ms/webapp-linux
2020-05-29T20:01:30.864174441Z NodeJS quickstart: https://aka.ms/node-qs
2020-05-29T20:01:30.864177741Z NodeJS Version : v12.13.0
2020-05-29T20:01:30.864181041Z Note: Any data outside '/home' is not persisted
2020-05-29T20:01:30.864184441Z
2020-05-29T20:01:30.951441760Z Oryx Version: 0.2.20191105.2, Commit: 67e159d71419415435cb5d10c05a0f0758ee8809, ReleaseTagName: 20191105.2
2020-05-29T20:01:30.951840160Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2020-05-29T20:01:30.951915661Z Could not find operation ID in manifest. Generating an operation id...
2020-05-29T20:01:30.952061661Z Build Operation ID: dfd18989-3b7b-4e2e-a64e-cf7310361e99
2020-05-29T20:01:32.750738663Z Writing output script to '/opt/startup/startup.sh'
2020-05-29T20:01:33.355033998Z Running #!/bin/sh
2020-05-29T20:01:33.359017599Z
2020-05-29T20:01:33.359033399Z # Enter the source directory to make sure the script runs where the user expects
2020-05-29T20:01:33.359644199Z cd "/home/site/wwwroot"
2020-05-29T20:01:33.359658399Z
2020-05-29T20:01:33.359664799Z export NODE_PATH=$(npm root --quiet -g):$NODE_PATH
2020-05-29T20:01:33.360538899Z if [ -z "$PORT" ]; then
2020-05-29T20:01:33.360552699Z export PORT=8080
2020-05-29T20:01:33.360557899Z fi
2020-05-29T20:01:33.360561499Z
2020-05-29T20:01:33.361582699Z npm start
2020-05-29T20:01:35.698639821Z
2020-05-29T20:01:35.698668521Z > <project-name>#0.0.1 start /home/site/wwwroot
2020-05-29T20:01:35.698675121Z > nest start
2020-05-29T20:01:35.698679221Z
2020-05-29T20:01:35.930729770Z internal/modules/cjs/loader.js:797
2020-05-29T20:01:35.930766970Z throw err;
2020-05-29T20:01:35.930772870Z ^
2020-05-29T20:01:35.930776770Z
2020-05-29T20:01:35.930780670Z Error: Cannot find module '../commands'
2020-05-29T20:01:35.930784670Z Require stack:
2020-05-29T20:01:35.930788470Z - /home/site/wwwroot/node_modules/.bin/nest
2020-05-29T20:01:35.930792370Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
2020-05-29T20:01:35.930803370Z at Function.Module._load (internal/modules/cjs/loader.js:687:27)
2020-05-29T20:01:35.930807770Z at Module.require (internal/modules/cjs/loader.js:849:19)
2020-05-29T20:01:35.930811570Z at require (internal/modules/cjs/helpers.js:74:18)
2020-05-29T20:01:35.930815370Z at Object. (/home/site/wwwroot/node_modules/.bin/nest:5:20)
2020-05-29T20:01:35.930819770Z at Module._compile (internal/modules/cjs/loader.js:956:30)
2020-05-29T20:01:35.930823570Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
2020-05-29T20:01:35.930827470Z at Module.load (internal/modules/cjs/loader.js:812:32)
2020-05-29T20:01:35.930831270Z at Function.Module._load (internal/modules/cjs/loader.js:724:14)
2020-05-29T20:01:35.930835070Z at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10) {
2020-05-29T20:01:35.930838970Z code: 'MODULE_NOT_FOUND',
2020-05-29T20:01:35.930842770Z requireStack: [ '/home/site/wwwroot/node_modules/.bin/nest' ]
2020-05-29T20:01:35.930846670Z }
2020-05-29T20:01:35.970252977Z npm ERR! code ELIFECYCLE
2020-05-29T20:01:35.979824678Z npm ERR! errno 1
2020-05-29T20:01:35.981324478Z npm ERR! <project-name>#0.0.1 start: `nest start`
2020-05-29T20:01:35.982002178Z npm ERR! Exit status 1
2020-05-29T20:01:35.982641778Z npm ERR!
2020-05-29T20:01:35.991823280Z npm ERR! Failed at the <project-name>#0.0.1 start script.
2020-05-29T20:01:35.991838780Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-05-29T20:01:36.118651500Z
2020-05-29T20:01:36.119439400Z npm ERR! A complete log of this run can be found in:
2020-05-29T20:01:36.128548002Z npm ERR! /root/.npm/_logs/2020-05-29T20_01_35_990Z-debug.log
At this point I can't figure out what is wrong. Any help would be greatly appreciated.

More than likely, you're using npm start which is mapped to nest start by default. The problem you'll run into with this is that #nestjs/cli (where the nest command comes from) is a part of devDependencies by default, so unless you've moved it, Azure is probably scrubbing the devDeps and keeping on prod deps. You should be using node dist/main to start your app instead to remove this problem without bloating your dependencies. Otherwise, adding #nestjs/cli to dependencies should fix it.

Related

'npm install' gets stuck and eventually 'Killed' at something called 'swc...' on Ubuntu 20.04

Okay so I have been trying to deploy a Next app to my Ubuntu 20.04 vps but I am unable to do so. I have uploaded all the files from my local machine to the server via ftp and then after trying to install it gets stuck and then killed ( please check the image to see where it gets stuck ). The app works perfectly in my local machine.
I tried by deleting .next directory, node_modules directory as well as package-lock.json file but the problem prevails.
Here's the Node and NPM version in my local machine:
Node: v14.15.0
NPM: v7.14.0
This is the Node and NPM version in my server:
Node: v14.18.2
NPM: v8.3.0
I have also attached my package.json file incase you want to see the dependencies
UPDATE
I some how installed the dependencies but now I am getting different type of errors when I run 'npm run dev' or 'npm run build'.
Here's what I get after I run npm run dev:
[20:09] [server1.example.com boomboom] # npm run dev
> boomboom#0.1.0 dev
> next dev
warn - Port 3000 is in use, trying 3001 instead.
ready - started server on 0.0.0.0:3001, url: http://localhost:3001
info - Loaded env from /home/user1/node-apps/boomboom/.env.local
error - ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[4].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[4].use[2]!./styles/Footer.module.css
/home/user1/node-apps/boomboom/node_modules/source-map/lib/util.js:101
// above the root is a no-op. Therefore we can remove all '.
SyntaxError: Unexpected end of input
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: SyntaxError: /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url/node_modules/whatwg-url/package.json (directory description file): SyntaxError: Unexpected end of JSON input
<w> while resolving 'whatwg-url' in /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url to a directory
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: SyntaxError: /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url/node_modules/whatwg-url/package.json (directory description file): SyntaxError: Unexpected end of JSON input
<w> while resolving 'whatwg-url' in /home/user1/node-apps/boomboom/node_modules/mongodb-connection-string-url to a directory
This is what I get after I run npm run build:
[20:13] [server1.example.com boomboom] # npm run build
> boomboom#0.1.0 build
> next build
info - Loaded env from /home/user1/node-apps/boomboom/.env.local
info - Checking validity of types
error - ESLint: Failed to load plugin 'react' declared in '.eslintrc.json » eslint-config-next/core-web-vitals » /home/user1/node-apps/boomboom/node_modules/eslint-config-next/index.js': Cannot find module 'eslint-plugin-react' Require stack: - /home/user1/node-apps/boomboom/node_modules/eslint-config-next/index.js Referenced from: /home/user1/node-apps/boomboom/node_modules/eslint-config-next/index.js
> Build error occurred
/home/user1/node-apps/boomboom/node_modules/source-map/lib/util.js:101
// above the root is a no-op. Therefore we can remove all '.
SyntaxError: Unexpected end of input
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Object.<anonymous> (/home/user1/node-apps/boomboom/node_modules/source-map/lib/source-map-generator.js:9:12)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
info - Creating an optimized production build .[20:13] [server1.example.com boomboom] #

How do devs maintain old projects?

A year ago I've made a project for a course: https://github.com/GeorgeFlorian/Finished_link_project
Now, I am trying to make it work on my machine, but I have no luck.
I've got npm 7.13.0 and node 16.1.0.
I've ran npm update in order to update all the depencies.
Steps
I've cloned the repo into a PC than runs Linux Mint 20.1
I've ran npm install
npm update
npm run build and npm run serve return the same error:
georgeflorian#georgeflorian-desktop:~/New Volume/VSCode Projects/Finished_link_project$ npm run build
> proiect-link#0.1.0 build
> vue-cli-service build
⠧ Building for production...
ERROR Failed to compile with 1 error 2:55:41 PM
Syntax Error: TypeError: Cannot read property 'parseComponent' of undefined
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
ERROR Build failed with errors.
I have no idea how to trace the error: Syntax Error: TypeError: Cannot read property 'parseComponent' of undefined.
Also, the NodeJS server won't start:
georgeflorian#georgeflorian-desktop:~/New Volume/VSCode Projects/Finished_link_project/server$ node app.js
node:internal/fs/utils:343
throw err;
^
Error: ENOENT: no such file or directory, stat '/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/dist/favicon.ico'
at Object.statSync (node:fs:1527:3)
at resolveSync (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/node_modules/serve-favicon/index.js:187:17)
at favicon (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/node_modules/serve-favicon/index.js:61:12)
at Object.<anonymous> (/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/server/app.js:46:9)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47 {
errno: -2,
syscall: 'stat',
code: 'ENOENT',
path: '/home/georgeflorian/New Volume/VSCode Projects/Finished_link_project/dist/favicon.ico'
}
I believe that many dependencies are deprecated, but this begs two questions:
If it worked back then and it hasn't been touched since, why doesn't it work now ?
How can I fix all the deprecated dependencies if npm update did not fix them ?
Ultimately, I would like to learn how to approach this kind of situation. Thank you.

babel.config.js: Error while loading config - Cannot find module 'fibers'

This is driving me nuts.
IDE: Visual Studion 2019
Project: Created a new "Basic Vue.js project" - I chose the *.ts flavour
I validate the new site runs. It does.
Following the quick start on Vuetify : https://vuetifyjs.com/en/getting-started/quick-start/#bootstrapping-the-vuetify-object
After each step I validate the site will still compile and run.
I reach the section where we add new modules to our project. I run this line:
npm install sass sass-loader fibers deepmerge -D
And now the site will not run. When I debug I get this output:
------ Build started: Project: MCCC.Web, Configuration: Debug Any CPU ------
> mccc.web#0.1.0 build C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web
> vue-cli-service build
- Building for production...
Starting type checking service...
Using 1 worker with 2048MB memory limit
ERROR Failed to compile with 1 errors5:04:50 PM
error in ./src/main.ts
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js: Error while loading config - Cannot find module 'fibers'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js:17:32)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
# multi ./src/main.ts
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mccc.web#0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mccc.web#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dwainwright.BC\AppData\Roaming\npm-cache\_logs\2020-04-26T21_04_50_521Z-debug.log
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VisualStudio\v16.0\Node.js Tools\Microsoft.NodejsToolsV2.targets(60,5): error MSB3073: The command "npm run build" exited with code 1.
Done building project "MCCC.Web.njsproj" -- FAILED.
Build FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The line that sticks out the most to me is:
C:\Labs\MCCC\Web\MCCC-Web\MCCC.Web\babel.config.js: Error while loading config - Cannot find module 'fibers'
fibres is references in the babel.config.json where I added the rules laid out in quick start:
module.exports = {
presets: [
'#vue/app',
'#babel/preset-env'
],
rules: [
{
test: /\.s(c|a)ss$/,
use: [
'vue-style-loader',
'css-loader',
{
loader: 'sass-loader',
// Requires sass-loader#^7.0.0
options: {
implementation: require('sass'),
fiber: require('fibers'),
indentedSyntax: true // optional
},
// Requires sass-loader#^8.0.0
options: {
implementation: require('sass'),
sassOptions: {
fiber: require('fibers'),
indentedSyntax: true // optional
},
},
},
],
},
]
};
Does anybody know how i can resolve this? Happy to share further info; not sure what else you may need.
Are you using the latest version of the docs? I followed the link you provided and the anchor #bootstrapping-the-vuetify-object doesn't appear to exist anymore. I was able to get a basic project up and running successfully following these steps:
vue create myapp: Selected "custom" and ticked all the boxes, for TypeScript, chose the default "class-style components"
verified that npm run serve worked
vue add vuetify: Selected "Configure", and these options:
Y (default)
y
y
Material Design Icons (default)
N (default)
Y (default)
English (default)
npm run serve would run, but I got warnings about type declaration for vuetify/lib. This answer led me to this FAQ item which made the warnings go away. (You have to add "vuetify" to the compilerOptions.types array in the root tsconfig.json for the project.)
FWIW, fibers does not appear to be included in the project at all anymore (searched for "fibers" in package-lock.json). My babel.config.js file looks like:
module.exports = {
presets: [
'#vue/cli-plugin-babel/preset'
]
}
And vue.config.js looks like:
module.exports = {
transpileDependencies: [
'vuetify'
]
}
Hope this helps!

Successful node build on Azure Pipelines fails to start on App Service - dependency issues

Trying to migrate my node project to Azure. Moved my source to Azure Repos and set up Azure Pipelines CI/CD. My source passes tests, gets built and deployed to the App Service instance but there it fails to start.
2019-04-13T11:17:11.727563855Z / _ \ __________ _________ ____
2019-04-13T11:17:11.741887486Z / /_\ \___ / | \_ __ \_/ __ \
2019-04-13T11:17:11.741914387Z / | \/ /| | /| | \/\ ___/
2019-04-13T11:17:11.741924187Z \____|__ /_____ \____/ |__| \___ >
2019-04-13T11:17:11.741932687Z \/ \/ \/
2019-04-13T11:17:11.741953688Z A P P S E R V I C E O N L I N U X
2019-04-13T11:17:11.741963888Z
2019-04-13T11:17:11.741971688Z Documentation: http://aka.ms/webapp-linux
2019-04-13T11:17:11.741979588Z NodeJS quickstart: https://aka.ms/node-qs
2019-04-13T11:17:11.741987288Z NodeJS Version : v10.14.1
2019-04-13T11:17:11.741995089Z
2019-04-13T11:17:12.114900305Z Generating app startup command
2019-04-13T11:17:12.139813980Z Found scripts.start in /home/site/wwwroot/package.json
2019-04-13T11:17:12.164269945Z Running npm --prefix=/home/site/wwwroot start
2019-04-13T11:17:13.701617867Z
2019-04-13T11:17:13.701678868Z > my-app-server#1.0.0 start /home/site/wwwroot
2019-04-13T11:17:13.701692968Z > NODE_ENV=production pm2 start server.js
2019-04-13T11:17:13.701701469Z
2019-04-13T11:17:14.489068461Z internal/modules/cjs/loader.js:582
2019-04-13T11:17:14.489134763Z throw err;
2019-04-13T11:17:14.489144863Z ^
2019-04-13T11:17:14.489152863Z
2019-04-13T11:17:14.489160663Z Error: Cannot find module '../constants.js'
2019-04-13T11:17:14.489168863Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
2019-04-13T11:17:14.489177064Z at Function.Module._load (internal/modules/cjs/loader.js:506:25)
2019-04-13T11:17:14.489185164Z at Module.require (internal/modules/cjs/loader.js:636:17)
2019-04-13T11:17:14.489193164Z at require (internal/modules/cjs/helpers.js:20:18)
2019-04-13T11:17:14.489200964Z at Object. (/home/site/wwwroot/node_modules/.bin/pm2:11:20)
2019-04-13T11:17:14.489209464Z at Module._compile (internal/modules/cjs/loader.js:688:30)
2019-04-13T11:17:14.489217265Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
2019-04-13T11:17:14.489225365Z at Module.load (internal/modules/cjs/loader.js:598:32)
2019-04-13T11:17:14.489233165Z at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
2019-04-13T11:17:14.533531589Z at Function.Module._load (internal/modules/cjs/loader.js:529:3)
2019-04-13T11:17:14.609360341Z npm ERR! code ELIFECYCLE
2019-04-13T11:17:14.651011003Z npm ERR! errno 1
2019-04-13T11:17:14.651070504Z npm ERR! may-app-server#1.0.0 start: `NODE_ENV=production pm2 start server.js`
2019-04-13T11:17:14.651096805Z npm ERR! Exit status 1
2019-04-13T11:17:14.651106405Z npm ERR!
2019-04-13T11:17:14.651114605Z npm ERR! Failed at the my-app-server#1.0.0 start script.
2019-04-13T11:17:14.651122906Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-04-13T11:17:14.679406459Z
2019-04-13T11:17:14.710652581Z npm ERR! A complete log of this run can be found in:
2019-04-13T11:17:14.710698082Z npm ERR! /root/.npm/_logs/2019-04-13T11_17_14_602Z-debug.log
YAML:
trigger:
- master
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: NodeTool#0
inputs:
versionSpec: '10.14.2'
displayName: 'Install Node.js'
- script: |
npm run init
displayName: 'install deps'
- script: |
npm run build
displayName: 'build frontend'
- task: ArchiveFiles#2
displayName: 'Archive files'
inputs:
rootFolderOrFile: 'backend/'
includeRootFolder: false
verbose: true
- task: PublishBuildArtifacts#1
displayName: 'Publish artifacts: drop'
I have downloaded the artifacts and tried to run them locally, and I get the same error. If I reinstall dependencies it will run.
I have set '10.14.1' and 'Ubuntu-16.04' on the agent and the App Server instance has the same node version but the linux version is different (general) - can this be the reason?
On the other hand, it seems a bit odd zipping the built along with node_modules and copying over, is this the Azure way?
Thanks,
E.

bcrypt fails after a successful installation

I'm having trouble deploying my application on the OpenShift platform.
It seems like it's bcrypt that fails but everything also seems to install properly.
I'm afraid I'll be having same trouble with every node module I wanna use.
I thought that may be, the problem is with the version of the node module.
Still I have no clue. I hope someone could help me find out what's going on.
I copy bellow my entire jenkins console output (note that I had the exact same output after my first git push on the OpenShift server).
Started by user Jenkins Admin Building remotely on nodejsbldr in workspace /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/repo Checkout:repo / /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/repo - hudson.remoting.Channel#129c587:nodejsbldr Using strategy: Default Checkout:repo / /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/repo - hudson.remoting.LocalChannel#d1cdcd Wiping out workspace first. Cloning the remote Git repository Cloning repository origin Fetching upstream changes from ssh://mySshPrivateId#nodejs-caty.rhcloud.com/~/git/nodejs.git Seen branch in repository origin/HEAD Seen branch in repository origin/alpha Seen branch in repository origin/master Commencing build of Revision 26cbed22880b5ac3b5bab4b016dbc5fe75579792 (origin/alpha) Checking out Revision 26cbed22880b5ac3b5bab4b016dbc5fe75579792 (origin/alpha) No change to record in branch origin/alpha [repo] $ /bin/sh -xe /tmp/hudson154161094843280943.sh
+ source /usr/lib/openshift/cartridge_sdk/bash/sdk
++ '[' false == true ']'
++ OO_BASH_SDK=true
+ alias 'rsync=rsync --delete-after -az -e '\''/usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh'\'''
+ upstream_ssh=mySshPrivateId#nodejs-caty.rhcloud.com
+ rm -f /var/lib/openshift/myPrivateWorkSpace//app-deployments/current/metadata.json
+ marker_present force_clean_build
+ '[' -f /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/repo//.openshift/markers/force_clean_build ']'
+ set +e
+ rsync --delete-after -az -e /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh 'mySshPrivateId#nodejs-caty.rhcloud.com:$OPENSHIFT_BUILD_DEPENDENCIES_DIR' /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/build-dependencies/
+ rsync --delete-after -az -e /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh 'mySshPrivateId#nodejs-caty.rhcloud.com:$OPENSHIFT_DEPENDENCIES_DIR' /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/dependencies/
+ set -e
+ gear build Building git ref 'origin/alpha', commit 26cbed2 Building NodeJS cartridge npm info it worked if it ends with ok npm info using npm#1.2.17 npm info using node#v0.10.5 npm info preinstall Caty#0.0.1a npm info build /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/repo npm info linkStuff Caty#0.0.1a npm info build /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/repo/node_modules/csrf npm info preinstall csrf#0.0.3 npm info linkStuff csrf#0.0.3 npm info install csrf#0.0.3 npm info postinstall csrf#0.0.3 npm info build /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/repo/node_modules/session-mongoose npm info preinstall session-mongoose#0.4.1 npm info linkStuff session-mongoose#0.4.1 npm info install session-mongoose#0.4.1 npm info postinstall session-mongoose#0.4.1 npm info install Caty#0.0.1a npm info postinstall Caty#0.0.1a npm info prepublish Caty#0.0.1a npm info ok
+ /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh mySshPrivateId#nodejs-caty.rhcloud.com 'gear stop --conditional
--exclude-web-proxy --git-ref gtiRefNum' Stopping gear... Stopping MongoDB cartridge Stopping NodeJS cartridge
++ /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh mySshPrivateId#nodejs-caty.rhcloud.com 'gear create-deployment-dir'
+ deployment_dir=2014-03-12_22-42-14.111
+ rsync --delete-after -az -e /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh /var/lib/openshift/myPrivateWorkSpace//app-deployments/current/metadata.json mySshPrivateId#nodejs-caty.rhcloud.com:app-deployments/2014-03-12_22-42-14.111/metadata.json
+ rsync --delete-after -az -e /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh
--exclude .git /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/repo/ mySshPrivateId#nodejs-caty.rhcloud.com:app-root/runtime/repo/
+ rsync --delete-after -az -e /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/build-dependencies/ mySshPrivateId#nodejs-caty.rhcloud.com:app-root/runtime/build-dependencies/
+ rsync --delete-after -az -e /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh /var/lib/openshift/myPrivateWorkSpace/app-root/runtime/dependencies/ mySshPrivateId#nodejs-caty.rhcloud.com:app-root/runtime/dependencies/
+ /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh mySshPrivateId#nodejs-caty.rhcloud.com 'gear remotedeploy
--deployment-datetime 2014-03-12_22-42-14.111' Preparing build for deployment Deployment id is aa14cca3 Activating deployment Starting MongoDB cartridge Starting NodeJS cartridge
DEBUG: Running node-supervisor with DEBUG: program 'app.js' DEBUG:
--watch '.' DEBUG: --ignore 'undefined' DEBUG: --extensions 'node|js|coffee' DEBUG: --exec 'node'
DEBUG: Starting child process with 'node app.js' DEBUG: Watching directory '/var/lib/openshift/mySshPrivateId/app-root/runtime/repo' for changes. Failed to load c++ bson extension, using pure JS version
/var/lib/openshift/mySshPrivateId/app-root/runtime/repo/node_modules/bcrypt/node_modules/bindings/bindings.js:79
throw e
^ Error: /var/lib/openshift/mySshPrivateId/app-root/runtime/repo/node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at bindings (/var/lib/openshift/mySshPrivateId/app-root/runtime/repo/node_modules/bcrypt/node_modules/bindings/bindings.js:74:15)
at Object.<anonymous> (/var/lib/openshift/mySshPrivateId/app-root/runtime/repo/node_modules/bcrypt/bcrypt.js:1:97)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12) DEBUG: Program node app.js exited with code 8
DEBUG: Starting child process with 'node app.js' Archiving artifacts Finished: SUCCESS
The extracted quote about the versions :
using npm#1.2.17 npm info using node#v0.10.5
And my application dependencies list :
"dependencies": {
"express": "3.4.8",
"jade": "1.1.5",
"socket.io": "0.9.16",
"bcrypt": "0.7.7",
"colors": "0.6.2",
"connect": "2.13.0",
"connect-mongo": "0.4.0",
"cookie": "0.1.1",
"mongodb": "1.3.23",
"mongoose": "3.8.6"
},
Thanks in advance for anyone brave enough to risk his self into that bunch of infos. :)
I've had the same problem, I suspect that since I am working on a mac it is related to the OSX bcrypt compilation issue that is described here.
I have tried to remove the node_modules directory and let OpenShift run npm and download the dependencies again but for some reason that did not work for me.
I have ended up creating a new application and committing my repository while excluding the node_module folder which solved my problem.

Resources