"cannot find module" when installing npm modules on windows
I am new to NodeJS. I am trying to use npm on Windows 8.
I have installed using chocolatey, cinst nodejs.install (version 0.10.17).
I installed as administrator (and would prefer to run npm as a normal
user).
Node itself seems to be working, I can use the REPL to run simple programs.
If I try to install something using npm, I get cannot find module:
> node npm install express
module.js:340
throw err;
^
Error: Cannot find module 'C:\Users\Klas\Documents\My Dropbox\mina
egna\tech\node\webserver\npm'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
I have read the answers on Nodejs cannot find installed module on Windows?
but unfortunately it is still unclear to me what I have to do.
I have tried setting NODE_PATH:
In trying to follow this answer, I have tried setting it to
C:\Users\Klas\AppData\Roaming\npm\node_modules (but I had to create both
the npm and the subfolder node_modules myself)
I have tried creating a folder c:\node\node_module (according to this
advice, even though the installation did not even create a c:\node folder)
and setting it to that.
I have tried setting it to C:\Program
Files\nodejs\node_modules\npm\node_modules (which did exist after
installation)
I have also tried to create a node_modules folder below the current
working directory. As I understand it that is where local npm will be
installed?
None of these helped. So it seems to me that setting NODE_PATH is not the
solution?
Using the -g flag makes no difference (I would prefer not to use it).
I get the same error both as normal user and as administrator (I would
prefer to be a normal user).
I get the same error no matter where I execute the command, except when I
do it in C:\Program Files\nodejs, where I get
basedir=`dirname "$0"`
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
Bussa
Sunday, 1 September 2013
Saturday, 31 August 2013
iOS - Facebook: "(#100) Array does not resolve to a valid user ID";
iOS - Facebook: "(#100) Array does not resolve to a valid user ID";
In my app I post location, friends and photos to the user's wall. It works
just fine, except when I try to tag a friend and not upload a photo, then
I get the error:
Error ===== Error Domain=com.facebook.sdk Code=5 "The operation couldn't
be completed. (com.facebook.sdk error 5.)" UserInfo=0xa5e9620
{com.facebook.sdk:HTTPStatusCode=400,
com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 100;
message = "(#100) Array does not resolve to a valid user ID";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x97a4b70, state:
FBSessionStateOpen, loginHandler: 0x97a4c00, appID: 534257903313640,
urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy:
0xa5e2ac0>, expirationDate: 2013-10-31 02:09:29 +0000, refreshDate:
2013-09-01 02:55:35 +0000, attemptedRefreshDate: 0001-12-30 00:00:00
+0000, permissions:(
"video_upload",
"basic_info",
"publish_stream",
installed,
"status_update",
"user_friends",
"create_note",
"share_item",
"photo_upload",
"publish_actions"
)>}
I have no problem tagging a friend when I also upload a photo, and I have
no problem posting just a place to the wall also.
Here's my code:
- (IBAction)post2:(id)sender {
if ([FBSession.activeSession.permissions
indexOfObject:@"publish_actions"] == NSNotFound) {
// No permissions found in session, ask for it
NSArray *permissions = [[NSArray alloc]
initWithObjects:@"publish_actions", @"upload_photos", nil];
[FBSession.activeSession requestNewPublishPermissions:permissions
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
if (!error) {
[self post2:sender];
return;
// If permissions granted, publish the story
}
}];
}
else {
NSString *apiPath = nil;
NSMutableDictionary *params = [NSMutableDictionary
dictionaryWithObjectsAndKeys:@"oi", @"message", nil];
NSMutableArray *tags = [[NSMutableArray alloc] init];
if (self.foodPicture)apiPath = @"me/photos";
else apiPath= @"me/feed";
if(self.selectedPlace.id) {
[params setObject:self.selectedPlace.id forKey:@"place"];
}
NSString *tag = nil;
if(self.selectedFriends != nil) {
for (NSDictionary *user in self.selectedFriends) {
tag = [[NSString alloc]
initWithFormat:@"{\"tag_uid\":\"%@\"}",[user
objectForKey:@"id"] ];
[tags addObject:tag];
}
NSString *friendIdsSeparation=[tags
componentsJoinedByString:@","];
NSString *friendIds = [[NSString alloc]
initWithFormat:@"[%@]",friendIdsSeparation ]; [params
setObject:friendIds forKey:@"tags"];
}
if (self.foodPicture) {
[params setObject:self.foodPicture forKey:@"picture"];
}
FBRequest *request = [[FBRequest alloc] initWithSession:[FBSession
activeSession] graphPath:apiPath parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBRequestConnection *connection,
id result, NSError *error) {
if (error) {
NSLog(@"Error ===== %@",error.description);
}
else {
NSLog(@"eba!");
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Posted!" message:@"" delegate:self
cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
}];}
Thanks for the help
In my app I post location, friends and photos to the user's wall. It works
just fine, except when I try to tag a friend and not upload a photo, then
I get the error:
Error ===== Error Domain=com.facebook.sdk Code=5 "The operation couldn't
be completed. (com.facebook.sdk error 5.)" UserInfo=0xa5e9620
{com.facebook.sdk:HTTPStatusCode=400,
com.facebook.sdk:ParsedJSONResponseKey={
body = {
error = {
code = 100;
message = "(#100) Array does not resolve to a valid user ID";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x97a4b70, state:
FBSessionStateOpen, loginHandler: 0x97a4c00, appID: 534257903313640,
urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy:
0xa5e2ac0>, expirationDate: 2013-10-31 02:09:29 +0000, refreshDate:
2013-09-01 02:55:35 +0000, attemptedRefreshDate: 0001-12-30 00:00:00
+0000, permissions:(
"video_upload",
"basic_info",
"publish_stream",
installed,
"status_update",
"user_friends",
"create_note",
"share_item",
"photo_upload",
"publish_actions"
)>}
I have no problem tagging a friend when I also upload a photo, and I have
no problem posting just a place to the wall also.
Here's my code:
- (IBAction)post2:(id)sender {
if ([FBSession.activeSession.permissions
indexOfObject:@"publish_actions"] == NSNotFound) {
// No permissions found in session, ask for it
NSArray *permissions = [[NSArray alloc]
initWithObjects:@"publish_actions", @"upload_photos", nil];
[FBSession.activeSession requestNewPublishPermissions:permissions
defaultAudience:FBSessionDefaultAudienceFriends
completionHandler:^(FBSession *session, NSError *error) {
if (!error) {
[self post2:sender];
return;
// If permissions granted, publish the story
}
}];
}
else {
NSString *apiPath = nil;
NSMutableDictionary *params = [NSMutableDictionary
dictionaryWithObjectsAndKeys:@"oi", @"message", nil];
NSMutableArray *tags = [[NSMutableArray alloc] init];
if (self.foodPicture)apiPath = @"me/photos";
else apiPath= @"me/feed";
if(self.selectedPlace.id) {
[params setObject:self.selectedPlace.id forKey:@"place"];
}
NSString *tag = nil;
if(self.selectedFriends != nil) {
for (NSDictionary *user in self.selectedFriends) {
tag = [[NSString alloc]
initWithFormat:@"{\"tag_uid\":\"%@\"}",[user
objectForKey:@"id"] ];
[tags addObject:tag];
}
NSString *friendIdsSeparation=[tags
componentsJoinedByString:@","];
NSString *friendIds = [[NSString alloc]
initWithFormat:@"[%@]",friendIdsSeparation ]; [params
setObject:friendIds forKey:@"tags"];
}
if (self.foodPicture) {
[params setObject:self.foodPicture forKey:@"picture"];
}
FBRequest *request = [[FBRequest alloc] initWithSession:[FBSession
activeSession] graphPath:apiPath parameters:params
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBRequestConnection *connection,
id result, NSError *error) {
if (error) {
NSLog(@"Error ===== %@",error.description);
}
else {
NSLog(@"eba!");
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Posted!" message:@"" delegate:self
cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
}
}];}
Thanks for the help
Multiple channel's message comes into single channel
Multiple channel's message comes into single channel
i am fresher of Spring Integration, i am confuing one question which i
have multiple channels but now i want to assemble messages from those
channel into single channel, how to implement it ? my senario is that i
have lots of businees modues and each module will corresponding to one
channel, those channels will receive the request then assemble the message
into one single channel , then output to the jms server:
is below code possible ?
<channel id='a'/> <bridge input-channel='a' out-channel='assembled'/>
<channel id='b'/> <bridge input-channel='b' out-channel='assembled'/>
<channel id='b'/> <bridge input-channel='c' out-channel='assembled'/>
<channel id='c'/> <bridge input-channel='d' out-channel='assembled'/>
<channel id='assembled'/>
<!-- the router will desicde which jms gateway to be sent -->
<router input-channel='assembled' >
<channel id='to_jms1'/>
<channel id='to_jms2'/>
<jms-outbound-gateway id='jms1' channel='to_jms1'/>
<jms-outbound-gateway id='jms2' channel='to_jms2'/>
i am fresher of Spring Integration, i am confuing one question which i
have multiple channels but now i want to assemble messages from those
channel into single channel, how to implement it ? my senario is that i
have lots of businees modues and each module will corresponding to one
channel, those channels will receive the request then assemble the message
into one single channel , then output to the jms server:
is below code possible ?
<channel id='a'/> <bridge input-channel='a' out-channel='assembled'/>
<channel id='b'/> <bridge input-channel='b' out-channel='assembled'/>
<channel id='b'/> <bridge input-channel='c' out-channel='assembled'/>
<channel id='c'/> <bridge input-channel='d' out-channel='assembled'/>
<channel id='assembled'/>
<!-- the router will desicde which jms gateway to be sent -->
<router input-channel='assembled' >
<channel id='to_jms1'/>
<channel id='to_jms2'/>
<jms-outbound-gateway id='jms1' channel='to_jms1'/>
<jms-outbound-gateway id='jms2' channel='to_jms2'/>
How do I verify SSL connection with a server through bash?
How do I verify SSL connection with a server through bash?
I have a server where certificates are installed. The hostname of server
is abc.example.com. The certificates installed on server has different DNS
name in CN (def.example.com). However, the certificate has SubjAltNames
which specifies both abc.example.com and def.example.com. This server runs
a Tomcat server and has keystore properly configured. The client has the
necessary RootCA installed. I want to verify through bash script that if a
connection attempt to the server succeeds in this scenario. I tried using
following command -
`wget --server-response --max-redirect=0 https://abc.example.com:443/myapp`
However, both the command fails with ERROR: certificate common name
def.example.com' doesn't match requested host nameabc.example.com'.
Any inputs on how can I verify that the root-ca installed on client is
indeed usable to connect to the server?
I have a server where certificates are installed. The hostname of server
is abc.example.com. The certificates installed on server has different DNS
name in CN (def.example.com). However, the certificate has SubjAltNames
which specifies both abc.example.com and def.example.com. This server runs
a Tomcat server and has keystore properly configured. The client has the
necessary RootCA installed. I want to verify through bash script that if a
connection attempt to the server succeeds in this scenario. I tried using
following command -
`wget --server-response --max-redirect=0 https://abc.example.com:443/myapp`
However, both the command fails with ERROR: certificate common name
def.example.com' doesn't match requested host nameabc.example.com'.
Any inputs on how can I verify that the root-ca installed on client is
indeed usable to connect to the server?
NumPy : array methods and functions not working
NumPy : array methods and functions not working
I have a problem regarding NumPy arrays.
I cannot get array methods like .T or functions like numpy.concatenate to
work with arrays I create:
>>> a=np.array([1,2,3])
>>> a
array([1, 2, 3])
>>> a.T
array([1, 2, 3])
>>> np.concatenate((a,a),axis=0)
array([1, 2, 3, 1, 2, 3])
>>> np.concatenate((a,a),axis=1)
array([1, 2, 3, 1, 2, 3])
>>>
However when I create an array using bult-in functions like rand
everything is fine
>>> a=np.random.rand(1,4)
>>> a.T
array([[ 0.75973189],
[ 0.23873578],
[ 0.6422108 ],
[ 0.47079987]])
>>> np.concatenate((a,a),axis=0)
array([[ 0.92191111, 0.50662157, 0.75663621, 0.65802565],
[ 0.92191111, 0.50662157, 0.75663621, 0.65802565]])
Do you think it has to do with element types (int32 vs float64) ?
I anm running python 2.7 on windows 7
Any help would be greatly appreciated.
Thanks !
I have a problem regarding NumPy arrays.
I cannot get array methods like .T or functions like numpy.concatenate to
work with arrays I create:
>>> a=np.array([1,2,3])
>>> a
array([1, 2, 3])
>>> a.T
array([1, 2, 3])
>>> np.concatenate((a,a),axis=0)
array([1, 2, 3, 1, 2, 3])
>>> np.concatenate((a,a),axis=1)
array([1, 2, 3, 1, 2, 3])
>>>
However when I create an array using bult-in functions like rand
everything is fine
>>> a=np.random.rand(1,4)
>>> a.T
array([[ 0.75973189],
[ 0.23873578],
[ 0.6422108 ],
[ 0.47079987]])
>>> np.concatenate((a,a),axis=0)
array([[ 0.92191111, 0.50662157, 0.75663621, 0.65802565],
[ 0.92191111, 0.50662157, 0.75663621, 0.65802565]])
Do you think it has to do with element types (int32 vs float64) ?
I anm running python 2.7 on windows 7
Any help would be greatly appreciated.
Thanks !
How does an output buffer in a server work
How does an output buffer in a server work
How does an output buffer of a server application work in principle?
Input buffering is clear to me. You collect incoming data until, for
instance, a newline character indicating "end of line" is found.
But how would an output buffer be implemented (just roughly)? Thanks!
How does an output buffer of a server application work in principle?
Input buffering is clear to me. You collect incoming data until, for
instance, a newline character indicating "end of line" is found.
But how would an output buffer be implemented (just roughly)? Thanks!
HTML checkbox when select all tick doesn't show
HTML checkbox when select all tick doesn't show
<table class="list" id="example">
<thead>
<tr>
<td class="first" width="1" style="text-align: center;"><input
type="checkbox"
onclick="$('input[name*=\'selected\']').attr('checked',
this.checked);"></td>
<td class="left">
Username
</td>
<td class="left">
Status
</td>
<td class="left">
Date Added
</td>
<td class="right">
Action
</td>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><input type="checkbox"
name="selected[]" value="2">
</td>
<td class="left">testing</td>
<td class="left">Enabled</td>
<td class="left">31/08/2013</td>
<td class="right"> [ <a href="">Edit</a> ]</td>
</tr>
<tr>
<td style="text-align: center;"><input type="checkbox"
name="selected[]" value="1">
</td>
<td class="left">admin</td>
<td class="left">Enabled</td>
<td class="left">31/03/2013</td>
<td class="right">[ <a href="">Edit</a> ]</td>
</tr>
</tbody>
</table>
I got a checkbox when click will select all others checkbox, the first
time click the select all, others check box will checked shown tick. But
When uncheck the select all and select it again, the others checkbox
doesn't shown tick but when view source code checked="checked" does shown
<table class="list" id="example">
<thead>
<tr>
<td class="first" width="1" style="text-align: center;"><input
type="checkbox"
onclick="$('input[name*=\'selected\']').attr('checked',
this.checked);"></td>
<td class="left">
Username
</td>
<td class="left">
Status
</td>
<td class="left">
Date Added
</td>
<td class="right">
Action
</td>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;"><input type="checkbox"
name="selected[]" value="2">
</td>
<td class="left">testing</td>
<td class="left">Enabled</td>
<td class="left">31/08/2013</td>
<td class="right"> [ <a href="">Edit</a> ]</td>
</tr>
<tr>
<td style="text-align: center;"><input type="checkbox"
name="selected[]" value="1">
</td>
<td class="left">admin</td>
<td class="left">Enabled</td>
<td class="left">31/03/2013</td>
<td class="right">[ <a href="">Edit</a> ]</td>
</tr>
</tbody>
</table>
I got a checkbox when click will select all others checkbox, the first
time click the select all, others check box will checked shown tick. But
When uncheck the select all and select it again, the others checkbox
doesn't shown tick but when view source code checked="checked" does shown
Subscribe to:
Comments (Atom)