where to find pattern module - node.js

I want to try this module https://github.com/creationix/nstore fore simple storage .
But when i run this code :
// Load the library
var nStore = require('nstore');
// Create a store
var users = nStore.new('data/users.db', function () {
// It's loaded now
});
It gives me this error .
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'pattern'
at Function._resolveFilename (module.js:326:11)
at Function._load (module.js:271:25)
at require (module.js:355:19)
at Object.<anonymous> (/var/www/rahulutils/node_modules/nstore/nstore.js:4:15)
at Module._compile (module.js:411:26)
at Object..js (module.js:417:10)
at Module.load (module.js:343:31)
at Function._load (module.js:302:12)
at require (module.js:355:19)
at Object.<anonymous> (/var/www/rahulutils/testnstore.js:2:14)
where can i find this pattern module.
OR
any other simple key value database i can use pls suggest.

nstore usess 'pattern' package from NPM.
look at "dependencies":
https://github.com/creationix/nstore/blob/master/package.json
It should install with nstore (if you used npm install nstore)
If you checkout project from github you have to do:
npm install pattern
npm install step
and that's it.

Related

Cannot find module 'install-npm-version'

I'm developing this project with TypeScript: https://github.com/scott-lin/install-npm-version
When trying to consume the package within another project, I'm getting Cannot find module 'install-npm-version' error.
Repro Steps
npm install install-npm-version#1.0.2
Create repro.js file with const inv = require('install-npm-version'); as the content
Invoke the repro with node .\repro.js
Error
> node .\repro.js
module.js:545
throw err;
^
Error: Cannot find module 'install-npm-version'
at Function.Module._resolveFilename (module.js:543:15)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:593:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\scottlin.REDMOND\Desktop\test\repro.js:1:75)
at Module._compile (module.js:649:30)
at Object.Module._extensions..js (module.js:660:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:501:12)
at Function.Module._load (module.js:493:3)
PS C:\Users\scottlin.REDMOND\Desktop\test>
The main property in the package.json file is used to find the module when using as an in-code Node module. Yours starts with a slash, implying the root directory. This is incorrect, which is why your code is failing.
To fix:
Change
"main": "/lib/Install.js",
to
"main": "lib/Install.js",

' ReferenceError: _ is not defined ' : error is shown while use LODASH module in node.js , _.isString()

I have started learning node.js through various video tutorials.
Below code is not working, the output should be 'false' for first console.log() and 'true' second console.log().
This is my code in app.js:
console.log('Starting app');
console.log(_.isString(true));
console.log(_.isString('Saurabh'));
OUTPUT
in CMD :
saurabh#kumar:/var/www/html/notes-node$ nodejs app.js
Starting app
/var/www/html/notes-node/app.js:25
**console.log(_.isString(true));**
^
**ReferenceError: _ is not defined**
at Object.<anonymous> (/var/www/html/notes-node/app.js:25:13)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
saurabh#kumar:/var/www/html/notes-node$ npm -v
3.5.2
You have to install lodash using npm like
npm install --save lodash
Then you have to require it in file say app.js like
const _ = require('lodash');
You must have to follow these steps to use lodash in your project

When I first run my coffeescript,I got error--

when I execute this command,it is right--
coffee -v
it's output is right.`CoffeeScript version 1.6.1
but when I type
$ coffee
it got error,the log is below
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object #<Object> has no method 'split'
at Interface.setPrompt (readline.js:121:24)
at new REPLServer (repl.js:128:7)
at Object.start (repl.js:249:14)
at Object.start (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/repl.js:95:23)
at Object.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:76:32)
at Object.<anonymous> (/usr/local/lib/node_modules/coffee-script/bin/coffee:7:41)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
at EventEmitter._tickCallback (node.js:192:40)
I need your help
This is a design decision on the part of the CoffeeScript devs.
https://github.com/jashkenas/coffee-script/issues/2813
The CoffeeScript REPL no longer supports Node v0.6. You should be able to compile by passing a file though. If you want it to work, you will either need to use an older version of CoffeeScript, or a newer version of Node.

Cannot find module 'now' - nowjs and nodejs

I installed nodejs in my home folder (/home/myname/). No problems so far.
Then I installed nowjs and there was one warning:
Checking for node path: not found
Now when I try this example: http://nowjs.com/doc/example I get the error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^ Error: Cannot find module 'now'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (/var/www/www.mydomain.de/htdocs/helloworld_server.js:7:13)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
Something with the paths is wrong I guess...anyone knows how to fix this?
Thanks
try this before :
npm config set global true && \
echo 'export NODE_PATH="'$(npm root -g)'"' >> ~/.bashrc && \
. ~/.bashrc

node.js soap sample client fails to run

node client_soap.js
node.js:249
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module './http'
at Function._resolveFilename (module.js:333:15)
at Function._load (module.js:280:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object.<anonymous> (/home/a1/mysourc3e/client_soap.js:6:12)
at Module._compile (module.js:444:26)
at Object..js (module.js:462:10)
at Module.load (module.js:351:32)
at Function._load (module.js:309:12)
at module.js:482:10
npm list
/home/a1/mysourc3e
└─┬ soap#0.1.3
├── node-expat#1.5.0
└── request#2.2.6
I'm trying to run a sample code for node.js with soap.
I can't get https://github.com/milewise/node-soap/blob/master/lib/client.js to work.
Where do I get the module from?
Use require('http') instead of require('./http').
The HTTP module is built in to node, so you shouldn't tell the loader to look for it in the current directory (as the "./" prefix does).

Resources