Cannot find module './lib/should' - node.js

i have a test code and trying to run it
var should = require("should")
describe('Array', function(){
describe('#indexOf()', function(){
it('should return -1 when the value is not present',function(){
[1,2,3].indexOf(5).should.equal(-1);
[1,2,3].indexOf(0).should.equal(-1);
})
})
})
when i run it i am getting error
Error: Cannot find module './lib/should'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/ritesh/projects/passport-topcoder/node_modules/should/index.js:2:18)
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)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/ritesh/projects/passport-topcoder/test/module.test.js:1:76)
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)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at /usr/local/lib/node_modules/mocha/lib/mocha.js:152:27
at Array.forEach (native)
at Mocha.loadFiles (/usr/local/lib/node_modules/mocha/lib/mocha.js:149:14)
at Mocha.run (/usr/local/lib/node_modules/mocha/lib/mocha.js:306:31)
at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:348:7)
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)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:901:3
i included mocha and should in package.json but why i am facing this error .should is showing in my node modules also.please guideline

I faced the same issue, and I think it is because should package has been updated two hours ago (and it may have broken something).
npm install should#1.3.0
did the trick.
EDIT
Version 2.0.1 fixed the issue.

It simply means should from the NPM is not installed. Simply use
sudo npm install should
This means that it should install should from the node package manage.
Hope it makes stuff clearer.
Cheers.

Related

Can't find module with sqlite3 with Node on Ubuntu

I get the following error with "nodejs server.js"
Error: Cannot find module '/home/domain/mydomain.photos/node_modules/sqlite3/lib/binding/node-v11-linux-x64/node_sqlite3.node'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/relive/relive.photos/node_modules/sqlite3/lib/sqlite3.js:4:15)
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)
at Module.require (module.js:364:17)
The problem is that in "'/home/domain/mydomain.photos/node_modules/sqlite3/lib/binding/" i do not have a node-v11-linux-x64, but rather node-v46-linux-x64.
I am using Nodejs v0.10.25 and Sqlite v3.8.2.
Any ideas?

Cannot start (or even init) Karma on a new machine

After installing node.js, npm, python, and karma... can't run it as I keep getting the following message:
karma init
module.js:339
throw err;
^
Error: Cannot find module './modules/core.log'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (C:\Projects\JsVortex\node_modules\core-js\index.js:15:1)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (C:\Projects\JsVortex\node_modules\karma\lib\file-list.js:10:1)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
When I check:
C:\Projects\JsVortex\node_modules\core-js\index.js
Line 15 contains the following line: require('./modules/core.log');
Any ideas how to fix it?
Thanks

Error: Use CoffeeScript.register() or require the coffee-script/register module to require .iced.md files

my app.js is:
require("iced-coffee-script");
require("./serverOneNode.iced");
when I run it:
node app.js
got error:
/projectPath/node_modules/iced-coffee-script/lib/coffee-script/coffee-script.js:200
throw new Error("Use CoffeeScript.register() or require the coffee-s
^
Error: Use CoffeeScript.register() or require the coffee-script/register module to require .iced.md files.
at Object._base.(anonymous function) [as .iced] (/projectPath/node_modules/iced-coffee-script/lib/coffee-script/coffee-script.js:200:17)
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 Object.<anonymous> (/projectPath/app.js:2:1)
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)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
That began to happen after I updated iced-coffee-script and coffee-script.
I added line require('iced-coffee-script/register'); to file app.js before requiring serverOneNode.iced and problem was solved successfully.

NodeJS application start error

When i try to start my app i see the following error. How can i fix it?
Error: Module version mismatch. Expected 11, got 13.
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 Object.<anonymous> (/home/okoz/node_modules/xml2json/node_modules/node-expat/lib/node-expat.js:4:13)
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)
at Module.require (module.js:364:17)

Error: Module version mismatch. Expected 11, got 1

module.js:356
Module._extensions[extension](this, filename);
^
Error: Module version mismatch. Expected 11, got 1.
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 Object.<anonymous> (/home/awd/html/node_modules/canvas/lib/bindings.js:2:18)
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)
at Module.require (module.js:364:17)
Update your npm packages first - this error is thrown usually when you switch node.js version, but did not update dependencies. To update it:
npm update

Resources