Access denied when connecting to localhost with node - mysql

I have an error when I try to start my code with node (npm start).
I have MySQL, XAMPP and node installed.
The error is as followed:
webpack building...
Server started on port 3000
/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Parser.js:80
throw err; // Rethrow non-MySQL errors
^
Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'#'localhost' (using password: NO)
at Handshake.Sequence._packetToError (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
at Handshake.ErrorPacket (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/sequences/Handshake.js:103:18)
at Protocol._parsePacket (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Protocol.js:279:23)
at Parser.write (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Parser.js:76:12)
at Protocol.write (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/Connection.js:103:28)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:266:12)
at readableAddChunk (_stream_readable.js:253:11)
at Socket.Readable.push (_stream_readable.js:211:10)
at TCP.onread (net.js:585:20)
--------------------
at Protocol._enqueue (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Protocol.js:145:48)
at Protocol.handshake (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/protocol/Protocol.js:52:23)
at PoolConnection.connect (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/Connection.js:130:18)
at Pool.getConnection (/Users/RaphaelleG/Documents/SOEN343/node_modules/mysql/lib/Pool.js:48:16)
at Object.<anonymous> (/Users/RaphaelleG/Documents/SOEN343/server/config/database.js:14:6)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/RaphaelleG/Documents/SOEN343/server/app.js:18:16)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tecmarket#0.1.0 start: `node ./server/app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the tecmarket#0.1.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! /Users/RaphaelleG/.npm/_logs/2017-09-22T03_16_49_509Z-debug.log
Please can you help me resolve this error?

Related

Puppeteer install fails on Ubuntu 18.04 LTS

I am trying to install puppeteer on a VPS hosted by Linode (Ubuntu 18.04 LTS).
I run npm install puppeteer and run into the following error:
unhandledPromiseRejectionWarning: /home/kekearif/meh/node_modules/puppeteer/lib/cjs/puppeteer/install.js:138
catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at download (/home/kekearif/meh/node_modules/puppeteer/install.js:35:7)
(node:11036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11036) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
meh#1.0.0 /home/kekearif/meh
└── puppeteer#5.3.0 extraneous
npm WARN ws#7.3.1 requires a peer of bufferutil#^4.0.1 but none was installed.
npm WARN ws#7.3.1 requires a peer of utf-8-validate#^5.0.2 but none was installed.
npm WARN meh#1.0.0 No description
npm WARN meh#1.0.0 No repository field.
Any ideas how to fix this?

Unable to run npm start

So I am following an online course and I am stuck. I am running the command npm run start in cmd and it seems not to be working.
Here is the webpack.config.js file:
enter image description here
Here is the package.json file:
enter image description here
Here is the error code I get from cmd:
C:\Users\user\Desktop\complete-javascript-course-master\9-forkify\starter>npm run start
> forkify#1.0.0 start C:\Users\user\Desktop\complete-javascript-course-master\9-forkify\starter
> webpack-dev-server --mode development --open
internal/modules/cjs/loader.js:985
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:
- C:\Users\user\Desktop\complete-javascript-course-master\9-forkify\starter\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (C:\Users\user\Desktop\complete-javascript-course-master\9-forkify\starter\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\user\\Desktop\\complete-javascript-course-master\\9-forkify\\starter\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! forkify#1.0.0 start: `webpack-dev-server --mode development --open`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the forkify#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\user\AppData\Roaming\npm-cache\_logs\2020-05-04T10_43_57_046Z-debug.log
C:\Users\user\Desktop\complete-javascript-course-master\9-forkify\starter>
What could be possibly wrong please?

Error connecting to remote mysql through google cloud

After I run a command regarding the database, I get this:
{ SequelizeConnectionError: connect ETIMEDOUT ip:5432
at connection.connect.err (/Users/me/Documents/PetHotel/backend-sql/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:128:24)
at Connection.connectingErrorHandler (/Users/me/Documents/PetHotel/backend-sql/node_modules/pg/lib/client.js:140:14)
at Connection.emit (events.js:182:13)
at Socket.reportStreamError (/Users/me/Documents/PetHotel/backend-sql/node_modules/pg/lib/connection.js:71:10)
at Socket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
name: 'SequelizeConnectionError',
parent:
{ Error: connect ETIMEDOUT ip:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1121:14)
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: 'ip',
port: 5432 },
original:
{ Error: connect ETIMEDOUT ip:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1121:14)
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: 'ip',
port: 5432 } }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app-backend# db:reset:development: `cross-env MIGRATION_ENV=development node ./migrations/reset`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app-backend# db:reset:development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Is it something regarding google I wonder? I do have set 0.0.0.0/0 as authorised ip
From the error, it seems your app is not able to connect to CloudSQL instance possibly due to network restriction.
Opening instance to 0.0.0.0/0 is not a good idea.
Google suggest different ways yo connect to CloudSQL Instance here. One particular method is sql-proxy.
Hope these guides helps you to establish connection between your app and cloudsql.

cannot find node js module mysql

when i enter npm start in the cmd i got that error:
Error: Cannot find module 'mysql'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\fmanagement\db_mysql\dbconnection.js:1:75)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fmanagement#1.0.0 start: node ./bin/www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fmanagement#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\Flavio Luiz\AppData\Roaming\npm-cache_logs\2018-08-16T23_51_52_867Z-debug.log
after that im install mysql with
npm install -g mysql
and that is my dbconnection.js:
var mysql = require('mysql');
var connection=mysql.createPool({
host:'jdbc:mysql://localhost:3306/',
user:'root',
password:'',
database:'fmanagement'
});
module.exports=connection;
im newbie with node js. im doing something wrong?

Error When Executing Gulp on Mac OS X

Having trouble running Gulp, and not quite sure what the issue is here. I've Googled the error, yet all forums that have come up haven't fixed my issue.
Here's the relevant install info:
npm -v
2.11.3
node -v
v0.12.7
node -p process.versions
{ http_parser: '2.3',
node: '0.12.7',
v8: '3.28.71.19',
uv: '1.6.1',
zlib: '1.2.8',
modules: '14',
openssl: '1.0.1p' }
node -p process.platform
darwin
node -p process.arch
x64
And the error I'm getting when executing Gulp:
Error: `libsass` bindings not found in /PATH/TO/node_modules/gulp-sass/node_modules/node-sass/vendor/darwin-x64-14/binding.node. Try reinstalling `node-sass`?
at Object.sass.getBinaryPath (/PATH/TO/node_modules/gulp-sass/node_modules/node-sass/lib/extensions.js:148:11)
at Object.<anonymous> (/PATH/TO/node_modules/gulp-sass/node_modules/node-sass/lib/index.js:16:36)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/PATH/TO/node_modules/gulp-sass/index.js:163:21)
at Module._compile (module.js:460:26)
Kind of lost on what to do next...
Try running npm rebuild node-sass after npm install node-sass.