2
我剛剛添加了一個mysql連接,但腳本一直失敗。錯誤在下面,相關的js低於此值。NodeJS MySQL連接失敗
TypeError: 'undefined' is not a function (evaluating 'loadClass.bind(null, 'Types')')
app/node_modules/mysql/index.js:92
app/node_modules/mysql/index.js:138
Error: Cannot find module 'crypto'
phantomjs://bootstrap.js:289
phantomjs://bootstrap.js:254 in require
app/node_modules/mysql/lib/Connection.js:1
app/node_modules/mysql/lib/Connection.js:420
TypeError: '[object Object]' is not a constructor (evaluating 'new Connection({config: new ConnectionConfig(config)})')
app/node_modules/mysql/index.js:12 in createConnection
app.js
var Q = require("q");
var page = require('webpage').create();
//var crypto = require('./node_modules/crypto/sha1.js');
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'shaun',
password : 'somepassword',
database : 'db'
});
connection.connect();
NodeJS默認爲SSL嗎? – hd1
我也看看這些: app/node_modules/mysql/index.js:12 app/node_modules/mysql/index.js:92 app/node_modules/mysql/index.js:138 app/node_modules/mysql /lib/Connection.js:1 app/node_modules/mysql/lib/Connection.js:420 – isaac9A
是的,我想我必須在SQL模塊上打開一個問題。 https://github.com/felixge/node-mysql – Shaun