loopbackio / loopback-connector-sqlite3

SQLite3 Connector for LoopBack
Other
13 stars 22 forks source link

Node 10 under Windows - loopback-connector-sqlite3 doesnt work #40

Open fedir-indutnyi opened 6 years ago

fedir-indutnyi commented 6 years ago

Bug or feature request

Description of feature (or steps to reproduce if bug)

Under Node Js 8 under windows everything works well. But under node js 10 under windows doesnt work

Link to sample repo to reproduce issue (if bug)

Expected result

Actual result (if bug)

Additional information (Node.js version, LoopBack version, etc)

raymondfeng commented 6 years ago

Pls try loopback-connector-sqlite3@3.0.0

fedir-indutnyi commented 6 years ago

Hi Raymond, Thank you for answer. But issue is still there. Here are details that might help to suggest incompatibility issue:

  1. Common Computer Running Windows 7 (Windows 10 same errors);
  2. Node Js 10.
  3. I Updated module using npm install loopback-connector-sqlite3 --save. And Json for datasorses points to loopback-connector-sqlite3;
  4. Interesting Fact - If uninstall Node Js 10 and install Node Js 8 everything works!
  5. If i Uninstall Node Js8, and install node Js 10, then i see error. Basically if i run npm install loopback-connector-sqlite3 --save it takes 20 minutes to reinstall this module, successfully. But neverteless, when running my application - it happens error, which i pasted below in this email. Please note, error only happens in node js 10 under windows. And there is no such error in node js 8 under windows !. Important. Maybe i mistaken - but have a suggestion - maybe something to do with sqlite3(v4) which is loopback-connector-sqlite3 depend on?

Here are steps with error:

B:\backend>npm start

startupflow@1.0.0 start B:\backend node .

no original function chain to wrap

WARNING: LoopBack connector "loopback-connector-sqlite3" is not installed as any of the following modules:

./connectors/loopback-connector-sqlite3 loopback-connector-sqlite3

To fix, run:

npm install loopback-connector-sqlite3

events.js:167 throw er; // Unhandled 'error' event ^

Error: WARNING: LoopBack connector "loopback-connector-sqlite3" is not installed as any of the following modules:

./connectors/loopback-connector-sqlite3 loopback-connector-sqlite3

To fix, run:

npm install loopback-connector-sqlite3

at DataSource.setup

(B:\backend\node_modules\loopback-datasource-juggler\lib\datasource.js:304:28) at new DataSource (B:\backend\node_modules\loopback-datasource-juggler\lib\datasource.js:109:8) at Registry.createDataSource (B:\backend\node_modules\loopback\lib\registry.js:349:12) at dataSourcesFromConfig (B:\backend\node_modules\loopback\lib\application.js:415:19) at Function.app.dataSource (B:\backend\node_modules\loopback\lib\application.js:222:12) at B:\backend\node_modules\loopback-boot\lib\executor.js:174:9 at B:\backend\node_modules\loopback-boot\lib\executor.js:265:5 at Array.forEach () at forEachKeyedObject (B:\backend\node_modules\loopback-boot\lib\executor.js:264:20) at setupDataSources (B:\backend\node_modules\loopback-boot\lib\executor.js:173:3) at execute (B:\backend\node_modules\loopback-boot\lib\executor.js:32:3) at bootLoopBackApp (B:\backend\node_modules\loopback-boot\index.js:140:3) at Object. (B:\backend\server\server.js:21:1) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) Emitted 'error' event at: at DataSource.setup (B:\backend\node_modules\loopback-datasource-juggler\lib\datasource.js:304:14) at new DataSource (B:\backend\node_modules\loopback-datasource-juggler\lib\datasource.js:109:8) [... lines matching original stack trace ...] at Module.load (internal/modules/cjs/loader.js:599:32) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! startupflow@1.0.0 start: node . npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the startupflow@1.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\fvi62699\AppData\Roaming\npm-cache_logs\2018-08-29T09_20_17_261Z-debug.log

On Mon, Aug 27, 2018 at 7:01 PM Raymond Feng notifications@github.com wrote:

Pls try loopback-connector-sqlite3@3.0.0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/strongloop-community/loopback-connector-sqlite3/issues/40#issuecomment-416294352, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad71_O3mOcl_NHAega8rPMpqSgt3lAWLks5uVCXygaJpZM4WF9u- .

raymondfeng commented 6 years ago

I'm pretty sure it's related to sqlite3 installation. The module is a binary add-on. Can you try npm i sqlite3 --verbose to see what's happening?

fedir-indutnyi commented 6 years ago

Okey, I run following: npm i sqlite3 --verbose --save

It took a lot of time to install and produced following output:

B:\backend>npm i sqlite3 --verbose --save npm info it worked if it ends with ok npm verb cli [ 'C:\Program Files\nodejs\node.exe', npm verb cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', npm verb cli 'i', npm verb cli 'sqlite3', npm verb cli '--verbose', npm verb cli '--save' ] npm info using npm@6.2.0 npm info using node@v10.9.0 npm verb npm-session 9753630623ccb271 npm http fetch GET 304 https://registry.npmjs.org/sqlite3 1084ms (from cache) npm timing stage:loadCurrentTree Completed in 697803ms npm timing stage:loadIdealTree:cloneCurrentTree Completed in 72ms npm timing stage:loadIdealTree:loadShrinkwrap Completed in 4974ms npm http fetch GET 304 https://registry.npmjs.org/nan 474ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/request 579ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/extend 605ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/combined-stream 629ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/safe-buffer 903ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/har-validator 919ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/uuid 674ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/aws4 1769ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/mime-types 1801ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/qs 2005ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/oauth-sign 2196ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/tough-cookie 2422ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/form-data 4332ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/mime-db 721ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/ajv 1275ms (from cache) npm http fetch GET 304 https://registry.npmjs.org/punycode 296ms (from cache) npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 77531ms npm timing stage:loadIdealTree Completed in 85491ms npm timing stage:generateActionsToTake Completed in 109107ms npm verb correctMkdir C:\Users\fvi62699\AppData\Roaming\npm-cache_locks correctMkdir not in flight; initializing npm timing audit compress Completed in 168ms npm info audit Submitting payload of 107728bytes npm verb lock using C:\Users\fvi62699\AppData\Roaming\npm-cache_locks\staging-d3ce29cd5e4c6ebd.lock for B:\backend\node_modules.staging npm timing action:extract Completed in 4814ms npm timing action:finalize Completed in 1563ms npm timing audit submit Completed in 10770ms npm timing action:refresh-package-json Completed in 2063ms npm info lifecycle ajv@5.5.2~preinstall: ajv@5.5.2 npm info lifecycle aws4@1.8.0~preinstall: aws4@1.8.0 npm info lifecycle combined-stream@1.0.6~preinstall: combined-stream@1.0.6 npm info lifecycle extend@3.0.2~preinstall: extend@3.0.2 npm info lifecycle har-validator@5.1.0~preinstall: har-validator@5.1.0 npm info lifecycle mime-db@1.36.0~preinstall: mime-db@1.36.0 npm info lifecycle mime-types@2.1.20~preinstall: mime-types@2.1.20 npm info lifecycle form-data@2.3.2~preinstall: form-data@2.3.2 npm info lifecycle oauth-sign@0.9.0~preinstall: oauth-sign@0.9.0 npm info lifecycle punycode@1.4.1~preinstall: punycode@1.4.1 npm info lifecycle qs@6.5.2~preinstall: qs@6.5.2 npm info lifecycle safe-buffer@5.1.2~preinstall: safe-buffer@5.1.2 npm info lifecycle tough-cookie@2.4.3~preinstall: tough-cookie@2.4.3 npm info lifecycle uuid@3.3.2~preinstall: uuid@3.3.2 npm info lifecycle nan@2.10.0~preinstall: nan@2.10.0 npm info lifecycle request@2.88.0~preinstall: request@2.88.0 npm info lifecycle sqlite3@4.0.2~preinstall: sqlite3@4.0.2 npm timing action:preinstall Completed in 426ms npm info linkStuff ajv@5.5.2 npm info linkStuff aws4@1.8.0 npm info linkStuff combined-stream@1.0.6 npm info linkStuff extend@3.0.2 npm info linkStuff har-validator@5.1.0 npm info linkStuff mime-db@1.36.0 npm info linkStuff mime-types@2.1.20 npm info linkStuff form-data@2.3.2 npm info linkStuff oauth-sign@0.9.0 npm info linkStuff punycode@1.4.1 npm info linkStuff qs@6.5.2 npm info linkStuff safe-buffer@5.1.2 npm info linkStuff tough-cookie@2.4.3 npm info linkStuff uuid@3.3.2 npm verb linkBins [ { uuid: './bin/uuid' }, npm verb linkBins 'B:\backend\node_modules\sqlite3\node_modules\.bin', npm verb linkBins false ] npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 12000ms npm timing audit body Completed in 1268ms npm info linkStuff nan@2.10.0 npm info linkStuff request@2.88.0 npm info linkStuff sqlite3@4.0.2 npm timing action:build Completed in 451ms npm info lifecycle ajv@5.5.2~install: ajv@5.5.2 npm info lifecycle aws4@1.8.0~install: aws4@1.8.0 npm info lifecycle combined-stream@1.0.6~install: combined-stream@1.0.6 npm info lifecycle extend@3.0.2~install: extend@3.0.2 npm info lifecycle har-validator@5.1.0~install: har-validator@5.1.0 npm info lifecycle mime-db@1.36.0~install: mime-db@1.36.0 npm info lifecycle mime-types@2.1.20~install: mime-types@2.1.20 npm info lifecycle form-data@2.3.2~install: form-data@2.3.2 npm info lifecycle oauth-sign@0.9.0~install: oauth-sign@0.9.0 npm info lifecycle punycode@1.4.1~install: punycode@1.4.1 npm info lifecycle qs@6.5.2~install: qs@6.5.2 npm info lifecycle safe-buffer@5.1.2~install: safe-buffer@5.1.2 npm info lifecycle tough-cookie@2.4.3~install: tough-cookie@2.4.3 npm info lifecycle uuid@3.3.2~install: uuid@3.3.2 npm info lifecycle nan@2.10.0~install: nan@2.10.0 npm info lifecycle request@2.88.0~install: request@2.88.0 npm info lifecycle sqlite3@4.0.2~install: sqlite3@4.0.2

sqlite3@4.0.2 install B:\backend\node_modules\sqlite3 node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok node-pre-gyp verb cli [ 'C:\Program Files\nodejs\node.exe', node-pre-gyp verb cli 'B:\backend\node_modules\node-pre-gyp\bin\node-pre-gyp', node-pre-gyp verb cli 'install', node-pre-gyp verb cli '--fallback-to-build' ] node-pre-gyp info using node-pre-gyp@0.10.3 node-pre-gyp info using node@10.9.0 | win32 | x64 node-pre-gyp verb command install [] node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp info check checked for "B:\backend\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node" (not found) node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.2/node-v64-win32-x64.tar.gz node-pre-gyp http 200 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.2/node-v64-win32-x64.tar.gz node-pre-gyp info install unpacking node-v64-win32-x64/node_sqlite3.node node-pre-gyp info tarball done parsing tarball [sqlite3] Success: "B:\backend\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node" is installed via remote node-pre-gyp info ok npm verb lifecycle sqlite3@4.0.2~install: unsafe-perm in lifecycle true npm verb lifecycle sqlite3@4.0.2~install: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;B:\backend\node_modules\sqlite3\node_modules.bin;B:\backend\node_modules.bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\RSA SecurID Token Common;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\nodejs\;C:\Users\fvi62699\AppData\Roaming\npm npm verb lifecycle sqlite3@4.0.2~install: CWD: B:\backend\node_modules\sqlite3 npm timing action:install Completed in 75766ms npm info lifecycle ajv@5.5.2~postinstall: ajv@5.5.2 npm info lifecycle aws4@1.8.0~postinstall: aws4@1.8.0 npm info lifecycle combined-stream@1.0.6~postinstall: combined-stream@1.0.6 npm info lifecycle extend@3.0.2~postinstall: extend@3.0.2 npm info lifecycle har-validator@5.1.0~postinstall: har-validator@5.1.0 npm info lifecycle mime-db@1.36.0~postinstall: mime-db@1.36.0 npm info lifecycle mime-types@2.1.20~postinstall: mime-types@2.1.20 npm info lifecycle form-data@2.3.2~postinstall: form-data@2.3.2 npm info lifecycle oauth-sign@0.9.0~postinstall: oauth-sign@0.9.0 npm info lifecycle punycode@1.4.1~postinstall: punycode@1.4.1 npm info lifecycle qs@6.5.2~postinstall: qs@6.5.2 npm info lifecycle safe-buffer@5.1.2~postinstall: safe-buffer@5.1.2 npm info lifecycle tough-cookie@2.4.3~postinstall: tough-cookie@2.4.3 npm info lifecycle uuid@3.3.2~postinstall: uuid@3.3.2 npm info lifecycle nan@2.10.0~postinstall: nan@2.10.0 npm info lifecycle request@2.88.0~postinstall: request@2.88.0 npm info lifecycle sqlite3@4.0.2~postinstall: sqlite3@4.0.2 npm timing action:postinstall Completed in 382ms npm verb unlock done using C:\Users\fvi62699\AppData\Roaming\npm-cache_locks\staging-d3ce29cd5e4c6ebd.lock for B:\backend\node_modules.staging npm timing stage:executeActions Completed in 88839ms npm timing stage:rollbackFailedOptional Completed in 0ms npm timing stage:runTopLevelLifecycles Completed in 982713ms npm verb saving [ { name: 'sqlite3', spec: '^4.0.2', save: 'dependencies' } ] npm info lifecycle undefined~preshrinkwrap: undefined npm info lifecycle undefined~shrinkwrap: undefined npm info lifecycle undefined~postshrinkwrap: undefined

B:\backend>

But then when i run : npm start, it still gives error below (which is not happening under Node JS 8): B:\backend>npm start

startupflow@1.0.0 start B:\backend node .

no original function chain to wrap

WARNING: LoopBack connector "loopback-connector-sqlite3" is not installed as any of the following modules:

./connectors/loopback-connector-sqlite3 loopback-connector-sqlite3

To fix, run:

npm install loopback-connector-sqlite3

events.js:167 throw er; // Unhandled 'error' event ^

Error: WARNING: LoopBack connector "loopback-connector-sqlite3" is not installed as any of the following modules:

./connectors/loopback-connector-sqlite3 loopback-connector-sqlite3

To fix, run:

npm install loopback-connector-sqlite3

at DataSource.setup

(B:\backend\node_modules\loopback-datasource-juggler\lib\datasource.js:304:28) at new DataSource (B:\backend\node_modules\loopback-datasource-juggler\lib\datasource.js:109:8) at Registry.createDataSource (B:\backend\node_modules\loopback\lib\registry.js:349:12) at dataSourcesFromConfig (B:\backend\node_modules\loopback\lib\application.js:415:19) at Function.app.dataSource (B:\backend\node_modules\loopback\lib\application.js:222:12) at B:\backend\node_modules\loopback-boot\lib\executor.js:174:9 at B:\backend\node_modules\loopback-boot\lib\executor.js:265:5 at Array.forEach () at forEachKeyedObject (B:\backend\node_modules\loopback-boot\lib\executor.js:264:20) at setupDataSources (B:\backend\node_modules\loopback-boot\lib\executor.js:173:3) at execute (B:\backend\node_modules\loopback-boot\lib\executor.js:32:3) at bootLoopBackApp (B:\backend\node_modules\loopback-boot\index.js:140:3) at Object. (B:\backend\server\server.js:21:1) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) Emitted 'error' event at: at DataSource.setup (B:\backend\node_modules\loopback-datasource-juggler\lib\datasource.js:304:14) at new DataSource (B:\backend\node_modules\loopback-datasource-juggler\lib\datasource.js:109:8) [... lines matching original stack trace ...] at Module.load (internal/modules/cjs/loader.js:599:32) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! startupflow@1.0.0 start: node . npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the startupflow@1.0.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\fvi62699\AppData\Roaming\npm-cache_logs\2018-08-29T17_01_39_179Z-debug.log

B:\backend>

On Wed, Aug 29, 2018 at 5:15 PM Raymond Feng notifications@github.com wrote:

I'm pretty sure it's related to sqlite3 installation. The module is a binary add-on. Can you try npm i sqlite3 --verbose to see what's happening?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/strongloop-community/loopback-connector-sqlite3/issues/40#issuecomment-416990337, or mute the thread https://github.com/notifications/unsubscribe-auth/Ad71_IFCtd8AyEh1pJ7_jM3ZCPZVs27Zks5uVq_-gaJpZM4WF9u- .

shubhddn01 commented 3 years ago

Does this issue have any solution?

mirandole commented 1 year ago

I've been able to manage this issue by doing these steps :

  1. In your lp4 app root path, add the "loopback-connector-sqlite3" dependency to the package.json file :
  2. Then at the end of the package.json file, before the last }, add an "overrides" section to override sqlite3 version used by "loopback-connector-sqlite3". Save and exit the package.json file.
  3. Then exec the npm install command
  "dependencies": {
    "@loopback/boot": "^6.1.2",
    "@loopback/core": "^5.1.2",
    "@loopback/repository": "^6.1.2",
    "@loopback/rest": "^13.1.2",
    "@loopback/rest-explorer": "^6.1.2",
    "@loopback/service-proxy": "^6.1.2",
    "loopback-connector-sqlite3": "3.0.0",
    "tslib": "^2.0.0"
  },
  "devDependencies": {
    "@loopback/build": "^10.1.2",
    "source-map-support": "^0.5.21",
    "@loopback/testlab": "^6.1.2",
    "@types/node": "^16.18.40",
    "@loopback/eslint-config": "^14.0.3",
    "eslint": "^8.47.0",
    "typescript": "~5.1.6"
  },
  "overrides": {
    "loopback-connector-sqlite3": {
      "sqlite3": "5.1.6"
    }
  }

Now, You should have the "loopback-connector-sqlite3" installed and working well.`

Artoria2e5 commented 10 months ago

I think this issue can be closed now. The lesson is: if you want to require/import something, put it in the dependencies. The node_modules folder is often not "flat"!