PatNeedham / google-it

command line Google search and save to JSON
104 stars 35 forks source link

Cannot use programmatically #83

Closed zeldalegends closed 2 years ago

zeldalegends commented 2 years ago

Version of google-it -- google-it@1.6.2

Versions of npm and node 6.14.13 v14.17.0

Describe the bug Cannot use it programmatically. Require command throws errors.

Welcome to Node.js v14.17.0.
Type ".help" for more information.
> const g = require('google-it')
Uncaught:
Error: UNKNOWN: unknown error, lstat 'C:\test\node_modules\htmlparser2\lib'
    at Object.realpathSync (fs.js:1796:7)
    at toRealPath (internal/modules/cjs/loader.js:349:13)
    at tryFile (internal/modules/cjs/loader.js:345:10)
    at tryPackage (internal/modules/cjs/loader.js:301:16)
    at Function.Module._findPath (internal/modules/cjs/loader.js:521:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:872:27)
    at Function.Module._load (internal/modules/cjs/loader.js:730:27)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18) {
  errno: -4094,
  syscall: 'lstat',
  code: 'UNKNOWN',
  path: 'C:\\test\\node_modules\\htmlparser2\\lib'
}
> console.log(g)
Uncaught ReferenceError: g is not defined

Expected behavior Require should instantiate g withour errors.

zeldalegends commented 2 years ago

It was a problem of corrupted files downloaded from npm. Not sure how it could happen... Just deleted /node_modules folders and recreated via npm install. It worked liked a charm. Thanks.