I am trying to deploy a Sails.js app to Bluemix and we are getting the following error during the deploy stage in the toolchain on Bluemix (When the CF PUSH command is called):
npm ERR! Cannot read property 'pause' of undefined
I understand the trace goes to the npm-error.log file, however, I haven't been able to get to it as we cannot ssh in to see whats in the file as the application is in its "off" state after a bad deploy.
This same code was successfully deployed with both Cf push {app name}} and through a simple build and deploy toolchain in Bluemix just 8 days ago.
In the build stage I can run Npm install and npm update just fine. However, it seems to do this again in the deploy stage regardless and it fails. Here is some detail on this failure
NODE_ENV=production
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
Visit http://docs.cloudfoundry.org/buildpacks/node/index.html#vendoring
NODE_HOME=/tmp/app/.cloudfoundry/0/node
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
Restoring cache
Loading 3 from cacheDirectories (default):
- .npm
- .cache/yarn (not cached - skipping)
- bower_components (not cached - skipping)
Installing node modules (package.json) Building dependencies
sails#0.12.13 preinstall /tmp/app/node_modules/sails
node ./lib/preinstall_npmcheck.js
Sails.js Installation: Checking npm-version successful
npm ERR! Cannot read property 'pause' of undefined
npm ERR! /tmp/app/.npm/_logs/2017-09-09T17_02_48_660Z-debug.log
**ERROR** Unable to build dependencies: exit status 1
Failed to compile droplet
Exit status 223
Staging failed: Exited with status 223
Destroying container
npm ERR! A complete log of this run can be found in:
Successfully destroyed container
Package.json file
{
"name": "myApp",
"private": true,
"version": "0.0.1",
"description": "Stuff my app does",
"keywords": [
"Cool Apps"
],
"dependencies": {
"bcryptjs": "^2.4.3",
"cacheman": "^2.2.1",
"ejs": "2.3.4",
"elasticsearch": "^13.0.0-rc2",
"find-remove": "^1.0.1",
"fs": "0.0.1-security",
"grunt": "1.0.1",
"grunt-contrib-clean": "1.0.0",
"grunt-contrib-coffee": "1.0.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-cssmin": "1.0.1",
"grunt-contrib-jst": "1.0.0",
"grunt-contrib-less": "1.3.0",
"grunt-contrib-uglify": "1.0.1",
"grunt-contrib-watch": "1.0.0",
"grunt-sails-linker": "~0.10.1",
"grunt-sync": "0.5.2",
"include-all": "^1.0.0",
"jsonwebtoken": "^7.3.0",
"moment": "^2.18.1",
"moment-timezone": "^0.5.13",
"passport": "^0.2.x",
"passport-http-bearer": "^1.0.1",
"passport-idaas-openidconnect": "^1.1.0",
"passport-local": "^1.0.0",
"rc": "1.0.1",
"request": "^2.81.0",
"request-promise": "^4.2.0",
"sails": "~0.12.13",
"sails-disk": "~0.10.9",
"sails-mongo": "^0.12.2",
"stream": "0.0.2",
"uuid-1345": "^0.99.6",
"validator": "^7.0.0",
"natural-sort": "^1.0.0"
},
"scripts": {
"start": "node app.js"
},
"engines": {
"node": "^8.0.x",
"npm": "^5.0.x"
},
"main": "app.js",
"author": "Scott N",
"license": ""
}
Things I've tried so far.
-change node versions
-changed npm versions
-change dependencies versions to include the ^ prefix
-removed all dependencies but Sails in the package.json file
So Sails.js and the Nodebuildpack/Bluemix aren't playing well with each other.
Any help would be appreciated.
Thank you
It happens to me just the same. and I've to roll back the prev version of npm: 5.3.0 and it's working now. (BTW: macOS)
The error only happens when I update my npm version like this:
Update available 5.3.0 → 5.4.1
Run npm i -g npm to update
The best way to handle it is to update your package.json to use engines like so
"description": "a Sails application",
"keywords": [],
"engines": {
"node": "6.10.1",
"npm": "5.3.0"
},
Got this issue while trying to push to heroku which seems to be the npm version specified by #m-t, and also specifying the versions like above makes ibm bluemix pick it up as default node engine instead of using the latest stable version.
And don't forget to always specify your node and npm versions directly, instead of adding tilde or caret, this just to be safe. check https://stackoverflow.com/a/22345808/5836034 for more about tilde and caret
you can still check #sai-vennam answer here for more info
So I rolled back the sails version in the package.json file from 0.12 to 0.11 and it deployed fine. So CF PUSH and the newest sails version are not getting along on Bluemix. This was using Node 8.0 and NPM version ^5.0.x
Related
Question
What is wrong with my Dockerfile or bitbucket-pipelines.yml? Why are modules missing from the bitbucket pipelines environment?
Error
When I try to npm run build my Vue2 project with webpack using Bitbucket Pipelines, I get errors regarding missing modules.
From Logs
npm run build
> people-is#1.0.0 build /opt/atlassian/pipelines/agent/build
> node build/build.js
module.js:549
throw err;
^
Error: Cannot find module 'cli-spinners'
Files
Here are the files for configuration.
Dockerfile - builds cportwine/people-is
FROM node:8.10.0
RUN npm install
RUN npm install -g firebase-tools
CMD [ "npm", "run", "build" ]
bitbucket-pipelines.yml
image:
name: cportwine/people-is
pipelines:
default:
- step:
script:
- npm run build
package.json
{
"name": "people-is",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "cportwine",
"private": true,
"scripts": {
"dev": "node build/dev-server.js",
"start": "node build/dev-server.js",
"build": "node build/build.js",
"deploy": "firebase deploy --token $FIREBASE_TOKEN"
},
"dependencies": {
"rxjs": "^5.5.8",
"uuid": "^3.2.1",
"vue": "^2.5.16",
"vue-json-excel": "^0.1.9",
"vue-router": "^2.8.1",
"vue-rx": "^5.0.0",
"vuefire": "^1.4.5",
"vuetify": "^0.15.2"
},
"devDependencies": {
"autoprefixer": "^7.2.6",
"babel-core": "^6.22.1",
"babel-loader": "^7.1.4",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chalk": "^2.3.2",
"connect-history-api-fallback": "^1.5.0",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^0.28.11",
"cssnano": "^3.10.0",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-html": "^4.0.2",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.0.1",
"eventsource-polyfill": "^0.9.6",
"express": "^4.16.3",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"firebase": "^4.12.0",
"firebase-tools": "^3.17.7",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"opn": "^5.3.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.4.0",
"rimraf": "^2.6.0",
"semver": "^5.5.0",
"shelljs": "^0.7.6",
"url-loader": "^0.5.8",
"vue-loader": "^13.7.1",
"vue-style-loader": "^3.1.2",
"vue-template-compiler": "^2.5.16",
"vuex": "^2.5.0",
"webpack": "^2.6.1",
"webpack-bundle-analyzer": "^2.11.1",
"webpack-dev-middleware": "^1.12.2",
"webpack-hot-middleware": "^2.21.2",
"webpack-merge": "^4.1.2"
},
"engines": {
"node": ">=8.10.0",
"npm": ">= 5.6.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://chaddportwine#bitbucket.org/jahnelgroup/people-is.git"
},
"keywords": [],
"license": "ISC",
"homepage": "https://bitbucket.org/jahnelgroup/people-is#readme"
}
What I see
When I ls the node_modules folder in both environments, they do not match. Modules are missing from bitbucket pipelines.
local folder
people-is/node_modules
...
chalk
char-spinner
chardet
check-types
chokidar
chownr
cipher-base
circular-json
cjson
clap
class-utils
clean-css
cli-boxes
cli-cursor
cli-spinners
cli-table
cli-table2
cli-width
cliui
...
bitbucket folder
/opt/atlassian/pipelines/agent/build/node_modules
Woah, missing modules!
...
chalk
cli-cursor
co
...
What I have tried
I added a command to the bitbucket-pipelines.yml to npm install before I build.
bitbucket-pipelines.yml
image:
name: cportwine/people-is
pipelines:
default:
- step:
script:
- npm install
- npm run build
This adds some additional modules (like cli-spinners from the error) to /opt/atlassian/pipelines/agent/build/node_modules.
bitbucket folder
/opt/atlassian/pipelines/agent/build/node_modules
...
chalk
char-spinner
chardet
check-types
chokidar
chownr
cipher-base
circular-json
cjson
clap
class-utils
clean-css
cli-boxes
cli-cursor
cli-spinners
cli-table
cli-table2
cli-width
cliui
clone
clone-response
co
...
However, the build command still fails, due to a different missing module.
Error
> people-is#1.0.0 build /opt/atlassian/pipelines/agent/build
> node build/build.js
module.js:549
throw err;
^
Error: Cannot find module './_safeGet'
Solutions
I can now build the app, but I don't know why!
1 - Simplify the Dockerfile
I removed all the npm commands. Maybe the npm install commands were redundant? There was no advantage using the Docker Image to pre-install npm packages.
2 - Remove Node_Modules before install
Using the bitbucket-pipelines.yml, remove the node_modules folder, and then perform npm install -g npm and npm install and npm install -g firebase-tools.
File Changes
bitbucket-pipelines.yml (added lines)
image:
name: cportwine/people-is
pipelines:
default:
- step:
script:
- rm -r node_modules <---- remove
- npm install -g npm <---- install
- npm install <---- install
- npm install -g firebase-tools <---- install
- npm run build
Dockerfile (lines removed)
FROM node:8.10.0
<---- remove
CMD [ "npm", "run", "build" ]
Answer ?
I'm not sure why moving all the npm install stuff into the bitbucket.pipelines.yml solved my issue building the project. I thought Docker would enable me to define my environment, e.g., install a version of node/npm and firebase. And pipelines would "run" that.
If someone could explain what I am missing, I would accept that answer.
Answer
I received support from the Atlassian Team
Leave npm install -g firebase in the docker image.
Move npm install from the docker image to the
bitbucket-pipelines.yml file.
Reason
The node_modules folder was listed in .gitignore
tl;dr
My mistake - I forgot about .gitignore and how that affects the node_modules folder in source control, e.g., Bitbucket Pipelines.
I was looking at my local node_modules folder and building locally which worked.
However
The node_modules in source control, by design, is not in-sync with my local folder because it's included in the .gitignore file.
So
It was necessary for me to rm node_modules and npm install using the bitbucket-pipelines.yml. Now, BitPipes finds the modules I have installed locally.
This is sort of the point of maintaining the package.json, but I got confused.
I have been google and reading different SO and github issues about this for the last few hours. I have tried adding a phantomjs config file to an .ebextensions folder, I have tried including a buildspec file that installs phantom js, and a bunch of other things and I cant seem to get phantomjs installed on my elastic beanstalk instance running nodejs. This is the package.json and the error. Any ideas as how to get this working would be really helpful. Thanks!
This is the package.json
{
"name": "webcrawler",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha **/*.test.js",
"test-watch": "nodemon --exec 'npm test'",
"start": "node app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"#types/cheerio": "^0.22.6",
"#types/phantom": "^3.2.3",
"cheerio": "^1.0.0-rc.2",
"express": "^4.16.2",
"line-by-line": "^0.1.6",
"node-schedule": "^1.2.5",
"phantom": "^4.0.12",
"phantomjs-prebuilt": "^2.1.16",
"request": "^2.83.0",
"write": "^1.0.3"
},
"devDependencies": {
"#types/chai": "^4.0.10",
"#types/express": "^4.11.0",
"chai": "^4.1.2",
"mocha": "^4.0.1",
"sinon": "^4.1.3"
}
}
error
phantomjs-prebuilt#2.1.16 install /tmp/deployment/application/node_modules/phantomjs-prebuilt
node install.js
PhantomJS not found on PATH Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 Verified
checksum of previously downloaded file Extracting tar contents (via
spawned process) Removing
/tmp/deployment/application/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder
/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1515525280131/phantomjs-2.1.1-linux-x86_64
-> /tmp/deployment/application/node_modules/phantomjs-prebuilt/lib/phantom
Running npm install:
/opt/elasticbeanstalk/node-install/node-v7.10.1-linux-x64/bin/npm
Setting npm config jobs to 1 npm config jobs set to 1 Running npm
with --production flag Failed to run npm install. Snapshot logs for
more details. UTC 2018/01/09 19:17:20 cannot find application npm
debug log at /tmp/deployment/application/npm-debug.log
Traceback (most recent call last):
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in ....
Not the most ideal solution, but I downgraded the elastic beanstalk instance to an earlier version an then it started to work.
I am not able to run sails js project on my UBUNTU machine i've sails 0.10.5 and the below is the error i am getting
ahsan#ahsan-Inspiron-N5110:~/Desktop/CardCashP2/Website$ sails lift
info: Starting app...
warn: `sails.config.express` is deprecated; use `sails.config.http` instead.
warn: The adapter `sails-disk` appears to be designed for an earlier version of Sails.
warn: (it has a `registerCollection()` method.)
warn: Since you're running Sails v0.10.x, it probably isn't going to work.
warn: To attempt to install the updated version of this adapter, run:
warn: npm install sails-disk#0.10.x
error: There was an error attempting to require("sails-disk")
error: Is this a valid Sails/Waterline adapter? The following error was encountered ::
error: Adapter is not compatible with the current version of Sails.
ahsan#ahsan-Inspiron-N5110:~/Desktop/CardCashP2/Website$
my package.json file is:
{
"name": "",
"private": true,
"version": "0.0.0",
"description": "a Sails application",
"dependencies": {
"MD5": "1.2.1",
"autocomplete": "0.0.1",
"convert-json": "^0.4.0",
"cron": "^1.0.5",
"download": "^0.1.18",
"ejs": "0.8.4",
"emailjs": "^0.3.8",
"express": "^4.9.8",
"grunt": "0.4.1",
"ipv6": "^3.1.1",
"js-combinatorics": "^0.4.0",
"mkdirp": "^0.5.0",
"moment": "^2.9.0",
"mysql": "2.2.0",
"nodemailer": "0.6.3",
"optimist": "0.3.4",
"pagination": "^0.4.3",
"payment-paypal-payflowpro": "0.0.4",
"paynode": "^0.3.6",
"paypal-rest-sdk": "^1.0.0",
"pdfkit": "0.6.2",
"request": "2.34.0",
"request-json": "0.4.10",
"sails": "0.9.13",
"sails-disk": "~0.9.0",
"sequelize": "1.7.3",
"wkhtmltopdf": "^0.1.4",
"xlsjs": "^0.7.1"
},
"scripts": {
"start": "node app.js",
"debug": "node debug app.js"
},
"main": "app.js",
"repository": "",
"author": "",
"license": ""
}
i don't know what is happening and I've already burned penalty of hours doing R&D and fixing it
please help me get rid of this.
Sails and Node versions are:
ahsan#ahsan-Inspiron-N5110:~/Desktop/CardCashP2/Website$ sails --version
0.10.5
ahsan#ahsan-Inspiron-N5110:~/Desktop/CardCashP2/Website$ node --version
v0.10.35
Thanks
Your sails version is 0.10.5 but the sails-disk version specified in your package.json is "sails-disk": "~0.9.0",.
You should update your sails-disk to the latest version. Here's how:
In package.json:
Change "sails-disk": "~0.9.0", to "sails-disk": "*",. Save the file.
Now, run npm update --save.
This will update your sails-disk (probably to "sails-disk": "~0.10.0",) and also set that version in package.json.
Now try sails lift. Good luck !
PS. You should do the same for sails as that version is also not in sync with the installed version.
Update the version of sails-disk
For the version Sails 1 , "sails-disk": "^1.0.1" works.
npm remove --save sails-disk
npm install --save sails-disk
I am deploying a mean app to heroku and am using bower and grunt. Should I include my node modules in the git repo? If not, I'm really not sure how I need to deploy because the post script references a bower install from the node modules. Should I include my bower_components in the git repo? It doesn't seem like I should because isn't the whole point of the postscript the execute the bower install on heroku? But when I do I get an error. Here are my bower dependencies:
"dependencies": {
"angular": "1.2.x",
"angular-mocks": "~1.2.x",
"jquery": "1.10.2",
"bootstrap": "~3.1.1",
"angular-bootstrap" : "0.11.0"
}
And my package.json
{
"main": "server.js",
"engines": {
"node": "0.10.29"
},
"dependencies": {
"express": "~3.4.x",
"mongoose": "~3.6.x",
"mongodb": "^1.4.0",
"ejs": "*",
"email-templates" : "1.0.0",
"crypto": "0.0.3",
"lodash": "~2.4.1",
"aws-sdk": "2.0.0-rc11",
"passport" : "~0.1.17",
"passport-local" : "~0.1.6",
"connect-flash" : "~0.1.1",
"winston": "0.6.x",
"gm" : "1.16.0",
"apn" : "1.5.2",
"bcrypt-nodejs" : "latest",
"angular-wizard": "latest",
"point-in-polygon": "latest",
"node-mailgun": "0.0.2",
"nodemailer" : "0.7.0",
"passport-facebook" : "1.0.3"
},
"devDependencies": {
"supertest": "0.5.x",
"bower": "0.6.x",
"mocha": "1.8.x",
"should": "1.2.x",
"karma": "~0.10",
"protractor": "^0.24.2",
"http-server": "^0.6.1",
"bower": "^1.3.1",
"grunt-cli": "~0.1.13",
"grunt-env": "~0.4.1",
"grunt-node-inspector": "~0.1.3",
"grunt-contrib-watch": "~0.6.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-csslint": "^0.2.0",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-nodemon": "~0.2.0",
"grunt-concurrent": "~0.5.0",
"grunt-mocha-test": "~0.10.0",
"grunt-karma": "~0.8.2",
"grunt-protractor-runner": "~1.0.0",
"load-grunt-tasks": "~0.4.0",
"jasmine-reporters": "~0.4.0",
"karma": "~0.12.0",
"karma-jasmine": "~0.2.1",
"karma-coverage": "~0.2.0",
"karma-chrome-launcher": "~0.1.2",
"karma-firefox-launcher": "~0.1.3",
"karma-phantomjs-launcher": "~0.1.2",
"karma-junit-reporter": "~0.2",
"shelljs": "^0.2.6",
"xunit-file": "*"
},
"scripts": {
"postinstall": "node_modules/.bin/bower install",
"pretest": "npm install",
"test": "karma start test/karma.conf.js",
"test-single-run": "karma start test/karma.conf.js --single-run",
"preupdate-webdriver": "npm install",
"update-webdriver": "webdriver-manager update",
"preprotractor": "npm run update-webdriver",
"protractor": "protractor test/protractor-conf.js",
"update-index-async": "node -e \"require('shelljs/global'); sed('-i', /\\/\\/##NG_LOADER_START##[\\s\\S]*\\/\\/##NG_LOADER_END##/, '//##NG_LOADER_START##\\n' + cat('bower_components/angular-loader/angular-loader.min.js') + '\\n//##NG_LOADER_END##', 'app/index-async.html');\""
}
}
I get this error:
5816 info fsevents#0.2.0 Failed to exec install script
5817 error fsevents#0.2.0 install: `node-gyp rebuild`
5817 error Exit status 1
5818 error Failed at the fsevents#0.2.0 install script.
5818 error This is most likely a problem with the fsevents package,
5818 error not with npm itself.
5818 error Tell the author that this fails on your system:
5818 error node-gyp rebuild
5818 error You can get their info via:
5818 error npm owner ls fsevents
5818 error There is likely additional logging output above.
5819 error System Linux 3.8.11-ec2
5820 error command "/tmp/build_2cc32425-eae7-45af-8b95-104e1c2c7c53/vendor/node/bin/node" "/tmp/build_2cc32425-eae7-45af-8b95-104e1c2c7c53/vendor/node/bin/npm" "rebuild"
5821 error cwd /tmp/build_2cc32425-eae7-45af-8b95-104e1c2c7c53
5822 error node -v v0.10.29
5823 error npm -v 1.4.14
5824 error code ELIFECYCLE
5825 verbose exit [ 1, true ]
! Push rejected, failed to compile Node.js app
I have read that i need to npm install -g karma but that does not help. Or an error with the bower install... Are my dev dependencies incorrect?
I found this video tutorial from Joe Eames to be quite useful for developing with the MEAN stack and deploying to Heroku: http://pluralsight.com/training/courses/TableOfContents?courseName=building-angularjs-nodejs-apps-mean&highlight=
The guidance given is that you shouldn't include your node_modules in the git repo you should let Heroku build those for you when you deploy.
Reading through your files it seems that you perhaps have too many dependencies listed. i.e I don't think you need 'Bower' listed as a dev-dependency in package.json. Equally, the script you've included in your package.json is not something I've really seen before. I would deploy using either Heroku commands or the grunt build pack found here: github.com/mbuchetics/heroku-buildpack-nodejs-grunt.git
More description on how to deploy to Heroku using grunt can be found here: https://medium.com/#3runjo/how-to-deploy-a-grunt-project-on-heroku-c227cb1ddc56
I realise this isn't a full answer, but should give you enough leads to de-bug your problem.
You are missing a nodejs buildpack for heroku. Also if you are using grunt as I see you need to go for a grunt nodejs buildpack. This is the one:
https://github.com/mbuchetics/heroku-buildpack-nodejs-grunt
You just need to register in your Gruntfile.js the tasks for building in heroku like this for example:
grunt.registerTask('heroku:development', 'clean less mincss');
grunt.registerTask('heroku:production', 'clean less mincss uglify');
Also remember to add the config variable to heroku app:
heroku config:add BUILDPACK_URL=https://github.com/mbuchetics/heroku-buildpack-nodejs-grunt.git
You are using a really old version of bower in the package.json, mine is:
"scripts": {
"postinstall": "./node_modules/bower/bin/bower install"
},
"dependencies": {
"bower": "^1.3.5",
Add this to your .slugignore file:
/node_modules/grunt-karma/
/node_modules/grunt-protractor-runner/
/node_modules/karma/
/node_modules/karma-chrome-launcher/
/node_modules/karma-mocha/
/node_modules/karma-ng-html2js-preprocessor/
/node_modules/ngmin/
/node_modules/protractor/
/node_modules/rfile/
/node_modules/rfileify/
/node_modules/rhtml/
This solved my issue with the fsevents#0.2.0 issue.
When deploying an OpenShift node.js project with a depdency on browserify 4.0.0, I get an error installing browserify's dependencies. Specifically:
...
remote: npm ERR! Error: No compatible version found: stream-browserify#'^1.0.0'
remote: npm ERR! Valid install targets:
remote: npm ERR! ["0.0.0","0.0.1","0.0.2","0.0.3","0.0.4","0.1.0","0.1.1","0.1.2","0.1.3","1.0.0"]
...
Given that stream-browserify's version is ^1.0.0 according to browserify's depdency and that openshift is suggesting 1.0.0 is a valid install target, why is this failing? I have seen this error in other cases, whenever the highest available openshift version fits the careted package.json version.
Am I misunderstanding what the caret means? Is this an OpenShift bug?
My package.json:
{
"name": "SampleApp",
"version": "1.0.0",
"description": "do things online",
"keywords": [
"OpenShift",
"Node.js",
"application",
"openshift"
],
"author": {
"name": "J",
"email": "j#email.com",
"url": ""
},
"homepage": "http://www.openshift.com/",
"repository": {
"type": "git",
"url": "https://github.com/openshift/origin-server"
},
"engines": {
"node": "0.x",
"npm": "1.x"
},
"dependencies": {
"body-parser": "1.x",
"browserify": "4.0.0",
"cookie-parser": "1.x",
"cookie-session": "1.x",
"express": "4.x",
"fast-csv": "0.x",
"multer": "0.0.5",
"pg": "3.x",
"sql": "0.x",
"xlsx-extract": "0.0.4"
},
"devDependencies": {
},
"bundleDependencies": [],
"private": true,
"main": "server.js",
"scripts": {
"build-js": "browserify public/index.js -o public/index-bundle.js & browserify public/intake.js -o public/intake-bundle.js",
"start": "npm run build-js && node server.js"
}
}
This behaviour could be because of different versions on node and npm on your local machine and openshift environment. Start by fixing "engines" attribute in your package.json, something as below:
"engines": {
"node": ">= 0.10",
"npm": ">= 1.4"
}
If still the issue is there (on openshift) it is due to the unavailability of the nodejs/npm required versions on openshift environment. For example, as of today, on my local machine I may be using node version 0.10.28 and npm version 1.4.9, but on openshift nodejs default cartridge I have to be content with nodejs version 0.10.5 and npm version 1.2.17, which is a big gap.
So, in this case, the easiest way to get around is by using "npm shrinkwrap", which freezes the nested dependency versions that ought to be used, hence doing away with varied behaviour of npm versions to figure out the nested dependency to install.
Can read about shrinkwrap here: https://www.npmjs.org/doc/cli/npm-shrinkwrap.html
So, on your local machine:
run npm install and make sure everything works.
fire npm shrinkwrap This will create a file - "npm-shrinkwrap.json", with the required shrinkwrap info. Add, commit and push the file to the openshift git repo.