I'm trying to use mongodb-promise to access the MongoDB server, but i'm getting the following error:
{ Error: Cannot find module '../build/Release/bson'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/user/Repositories/learn-express/node_modules/mongodb-promise/node_modules/bson/ext/index.js:15:10)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3) code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
I'm using the last version of the package which is 0.0.4. Does anyone knows any package to deal with MongoDB using promises?
The mongodb-promise package is few years old, from the time MongoDB native Node.js driver did not support Promises. Just use the native driver, it has promise support now. More details in the documentation
Related
You are using a version of Node.js that is not supported by Hardhat,
and it may work incorrectly, or not work at all. Please, make sure you
are using a supported version of Node.js. To learn more about which
versions of Node.js are supported go to
https://hardhat.org/nodejs-versions
An unexpected error occurred:
Error: Cannot find module '#nomiclabs/hardhat-waffle'
Require stack:
- D:\3.1\dppa\hardhat.config.js
- D:\3.1\dppa\node_modules\hardhat\internal\core\config\config-loading.js
- D:\3.1\dppa\node_modules\hardhat\internal\cli\cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
at Function.Module._load (node:internal/modules/cjs/loader:780:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (D:\3.1\dppa\hardhat.config.js:1:1)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:827:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'D:\\3.1\\dppa\\hardhat.config.js',
'D:\\3.1\\dppa\\node_modules\\hardhat\\internal\\core\\config\\config-loading.js',
'D:\\3.1\\dppa\\node_modules\\hardhat\\internal\\cli\\cli.js'
]
}
PS D:\3.1\dppa>
It looks like you are trying to run the sample project and are missing plugins.
As stated here, you need to install some plugins for the sample project with the following command.
npm install --save-dev #nomiclabs/hardhat-waffle ethereum-waffle chai #nomiclabs/hardhat-ethers ethers
Besides that, as stated in the provided link, you should use the latest LTS of Node.js, which is Node.js 16 and can be downloaded here
I've developed an electron app with following tech stack:
NodeJS (10.15) with Babel to allow ES6 import/export syntax.
Sequelize on SQLite and GraphQL to handle an internal database.
ReactJS (bundled) for views.
I've configured everything to work with Electron and running "electron" command in project root folder works without errors.
Now i'm trying to distribute it using this tutorial: https://electronjs.org/docs/tutorial/application-distribution
So i've simply downloaded the 4.1.4 binaries for windows and moved the project folder under resources/app/
But running the electron.exe i've the following error:
App threw an error during load
TypeError: Cannot create property 'default' on symbol 'Symbol(nodejs.util.inspect.custom)'
at Object.<anonymous> (C:\workspace\myapp\resources\app\node_modules\graphql\jsutils\nodejsCustomInspectSymbol.js:18:84)
at Object.<anonymous> (C:\workspace\myapp\resources\app\node_modules\graphql\jsutils\nodejsCustomInspectSymbol.js:20:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Module._compile (C:\workspace\myapp\resources\app\node_modules\pirates\lib\index.js:83:24)
at Module._extensions..js (internal/modules/cjs/loader.js:722:10)
at Object.newLoader [as .js] (C:\workspace\myapp\resources\app\node_modules\pirates\lib\index.js:88:7)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\workspace\myapp\resources\app\node_modules\graphql\jsutils\defineToJSON.js:8:57)
at Object.<anonymous> (C:\workspace\myapp\resources\app\node_modules\graphql\jsutils\defineToJSON.js:36:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Module._compile (C:\workspace\myapp\resources\app\node_modules\pirates\lib\index.js:83:24)
at Module._extensions..js (internal/modules/cjs/loader.js:722:10)
at Object.newLoader [as .js] (C:\workspace\myapp\resources\app\node_modules\pirates\lib\index.js:88:7)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
i've also tried to run npx electron resources/app/ from binaries folder and i've got the same error.
So i think the issue is something about the paths.
i've also tried electron-packager and the error is the same because this tool does the same process of guide above.
What can i do to fix it?
UPDATE1: after some investigations i've found that babel causes the issues. I guess when you run a project from a parent folder. I'm trying to find a solution
i've solved using this kind of configuration for babel/register:
const rootPath=path.resolve(path.join(__dirname, "../../"));
require("#babel/register")({
root: rootPath,
extends: path.join(rootPath, '.babelrc'),
ignore: [/node_modules/],
only: [rootPath],
})
Very new to Db and JS and trying to learn ExpressJS, RethinkDb using a tutorial from this link.
https://github.com/rethinkdb/rethinkdb-example-nodejs-chat
I followed the instructions and hitting an error in basic module loading I suppose. Looks like some dependency problem or I'm probably missing some step.
As specified in the instruction, I have successfully setup rethinkDb and can see the DB explorer in
http://localhost:8080
But when node app is executed as specified in instructions, I"m hitting an error below. Any help in this regard please?
/Users/test/rethinkdb-example-nodejs-chat/node_modules/socket.io/lib/store.js:35
Store.prototype.__proto__ = EventEmitter.prototype;
^
TypeError: Cannot read property 'prototype' of undefined
at Object.<anonymous> (/Users/test/rethinkdb-example-nodejs-chat/node_modules/socket.io/lib/store.js:35:42)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/test/rethinkdb-example-nodejs-chat/node_modules/socket.io/lib/manager.js:16:13)
at Module._compile (module.js:643:30)
process.EventEmitter was deprecated and not working in new node version. This has been answered here
Can you rollback to older node.js version and see if you could run the tutorial
https://github.com/LearnBoost/websocket.io/issues/55
I am trying to get a particular npm package to run on Ubuntu 16.04. I am currently running the most up-to-date versions of nodejs and npm, as well as the package (turndown).
Here is the error that I get:
root#ubuntu-s-1vcpu-1gb-nyc1-01:/usr/server# nodejs index.js
/usr/server/node_modules/jsdom/lib/api.js:10
const { URL } = require("whatwg-url");
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
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 Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at createHTMLParser (/usr/server/node_modules/turndown/lib/turndown.cjs.js:529:17)
at Object.<anonymous> (/usr/server/node_modules/turndown/lib/turndown.cjs.js:537:60)
at Module._compile (module.js:410:26)
The error states it occurs within the "turndown" package and is due to the language in the constructor. What is confusing to me is that this runs on Fedora 27 without error.
What could be causing the difference in behavior?
The answer to this question was to update my version of NodeJS. I ran into another error now, but it is package related.
I upgraded from node v0.6.12 to 0.80 and started receiving the error below - I have removed the sys module from the import but am still getting the error. Any helpful hints would be helpful. I am not suing stylus either.
path.exists is now called `fs.exists`.
sys.js:1
throw new Error(
Error: The "sys" module is now called "util".
at sys.js:1:69
at NativeModule.compile (node.js:602:5)
at Function.NativeModule.require (node.js:570:18)
at Function.Module._load (module.js:297:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/node/node_modules/stylus/lib/token.js:12:15)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
Upgrade to node v0.8.1. It will solve your problem