yug95 / node-mysql Goto Github PK
View Code? Open in Web Editor NEWNode with mysql boilerplate
License: MIT License
Node with mysql boilerplate
License: MIT License
I have setup this sample. not sure if need to create db and table in mysql separately ? I am getting below error:
{
"code": "ER_NO_SUCH_TABLE",
"errno": 1146,
"sqlMessage": "Table 'sampledb.user' doesn't exist",
"sqlState": "42S02",
"index": 0,
"sql": "SELECT * FROM user WHERE username ='test'"
}
is there any db script that needs to be executed? DB i create manually, but not sure about table details.
Below is the error
\app\models\authentic.model.
js:42
return next(err);
^
ReferenceError: next is not defined
at \app\models\authentic
.model.js:42:21
at \node_modules\bcrypt
bcrypt.js:140:13
at process._tickCallback (internal/process/next_tick.js:61:11)
[nodemon] app crashed - waiting for file changes bef
[email protected] install /Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/fsevents
node install
node-pre-gyp WARN Using request for node-pre-gyp https download
[fsevents] Success: "/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" is installed via remote
[email protected] install /Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt
node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v67-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v67-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI) (falling back to source compile with node-gyp)
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
sed: ./Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw: No such file or directory
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
rm: ./Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw: No such file or directory
make: *** [Release/obj.target/bcrypt_lib/src/blowfish.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/Cellar/node/11.10.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.10.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt/lib/binding' (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:197:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:984:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 18.6.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/11.10.0/bin/node" "/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt
node-pre-gyp ERR! node -v v11.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/11.10.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt/lib/binding' (1)
touch: ./Release/.deps/Release/obj.target/bcrypt_lib/src/bcrypt.o.d.raw: No such file or directory
make: *** [Release/obj.target/bcrypt_lib/src/bcrypt.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/Cellar/node/11.10.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt/lib/binding"
gyp ERR! cwd /Users/admin/projects/react/bambiniinternational/backend/node-mysql/node_modules/bcrypt
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install 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! /Users/admin/.npm/_logs/2019-06-12T02_10_34_076Z-debug.log
Everytime I try to login in Postman it returns this JSON:
{
"error": {
"statusCode": 422,
"name": "ValidationError",
"message": "Unprocessable Entity",
"details": {
"context": "authentic",
"codes": [
"USERNAME_REQUIRED"
],
"messages": [
{
"USERNAME_REQUIRED": "should have required property 'username'"
}
]
}
}
}
I'm using MySQL database that I created manually like this:
CREATE TABLE `User` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) DEFAULT NULL,
`password` int(11) DEFAULT NULL,
`CreatedDate` datetime DEFAULT NULL,
`UpdatedDate` datetime DEFAULT NULL,
`UpdatedBy` int(11) DEFAULT NULL,
`IsEnabled` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
Here is a printscreen of how I am using it on Postman:
Can someone help me out please?
Installed all dependencies.
when I am going to run it, it is crashed.
server connected to port 9890
/Volumes/Work/node-mysql/node_modules/mysql/lib/protocol/Parser.js:80
throw err; // Rethrow non-MySQL errors
^
TypeError: Cannot read property 'release' of undefined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.