Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ciaranj/813640 to your computer and use it in GitHub Desktop.
Save ciaranj/813640 to your computer and use it in GitHub Desktop.
Unable to find 'qs'.
From f8c22a73e8c516963d8958796334413ccb243f17 Mon Sep 17 00:00:00 2001
From: ciaranj <ciaranj@gmail.com>
Date: Sun, 6 Feb 2011 19:36:23 +0000
Subject: [PATCH] Try and find qs on the path if npm module not there
---
lib/connect/middleware/bodyDecoder.js | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/connect/middleware/bodyDecoder.js b/lib/connect/middleware/bodyDecoder.js
index be22456..18a900d 100644
--- a/lib/connect/middleware/bodyDecoder.js
+++ b/lib/connect/middleware/bodyDecoder.js
@@ -8,8 +8,15 @@
/**
* Module dependencies.
*/
-
-var qs = require('qs');
+var qs;
+try {
+ qs = require('qs');
+} catch(err) {
+ // If npm not present (and qs not installed) and 'lib/support' hasn't been put on require.paths
+ // try and pull it in ourselves...
+ qs = require('../../../support/qs')
+}
+if( qs === undefined )
/**
* Extract the mime type from the given request's
--
1.7.2.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment