Closed n0m0r3pa1n closed 8 years ago
Sorry, my mistake
:+1:
Can you tell us how did you solve? Having the same problem (node 6.1). Both the methods throw the error, also if "new" and require are not used altogether. I tried to remove node_modules and reinstall again every package.
'use strict';
let lngDetector = new (require('language-detect'));
let lngDetector = new (require('./node_modules/language-detect/language-detect.js'));
fs.js:967
binding.stat(pathModule._makeLong(path), req);
^
TypeError: path must be a string or Buffer
My case was that I had messed the path for the require. Did you manage to solve it? If you just copy to code from the ReadMe and place it in a JS file (like test.js) and then install in the same directory languagedetect and run: "node test.js" it works.
var LanguageDetect = require('languagedetect');
var lngDetector = new LanguageDetect();
console.log(lngDetector.detect('This is a test.'));
// Only get the first 2 results
console.log(lngDetector.detect('This is a test.', 2));
yes, my bad... wrong module... "language-detect": "latest" => "languagedetect": "latest"
I use the library with Node 4.1. I get the following error: fs.js:878 binding.stat(pathModule._makeLong(path), req); ^
TypeError: path must be a string at TypeError (native) at Object.fs.stat (fs.js:878:11) at new module.exports (/home/nmp/WorkSpace/NaSp/NodeJS/AppHunt/node_modules/language-detect/language-detect.js:30:6) at Object. (/home/nmp/WorkSpace/NaSp/NodeJS/AppHunt/build/handlers/apps_handler.js:86:19)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object. (/home/nmp/WorkSpace/NaSp/NodeJS/AppHunt/test/helper/dbhelper.js:3:19)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object. (/home/nmp/WorkSpace/NaSp/NodeJS/AppHunt/test/app_test.js:5:16)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at /home/nmp/WorkSpace/NaSp/NodeJS/AppHunt/node_modules/mocha/lib/mocha.js:216:27
at Array.forEach (native)
at Mocha.loadFiles (/home/nmp/WorkSpace/NaSp/NodeJS/AppHunt/node_modules/mocha/lib/mocha.js:213:14)
at Mocha.run (/home/nmp/WorkSpace/NaSp/NodeJS/AppHunt/node_modules/mocha/lib/mocha.js:453:10)
at Object. (/home/nmp/WorkSpace/NaSp/NodeJS/AppHunt/node_modules/mocha/bin/_mocha:393:18)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:141:18)
at node.js:933:3
Any ideas why?