JFrankfurt / To-The-Moon-Bitcoin-Game

A Bitcoin Faucet Game
7 stars 7 forks source link

Mongoose wtf #18

Closed JFrankfurt closed 9 years ago

JFrankfurt commented 9 years ago

Python (???) something c++ dependencies and something something mongodb mongoose node-gyp rebuild bson

JFrankfurt commented 9 years ago

After I included mongoose and started trying to build out a User Schema we started getting the following errors:

{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version

And another saying mongoose.schema is undefined

PhillipChaffee commented 9 years ago

Maybe it's referring to C:\Users\Phillip\Dropbox\GitHub\moonbasefaucet\node_modules\mongoose\node_modules\mongodb\node_modules\bson\node_modules\nan\build ??? Maybe there is supposed to be a release folder there with a bson module? Is it possible that mongoose updated and node hasn't complied with the updates yet? Just thinking out loud.

PhillipChaffee commented 9 years ago

FIgured out the problem but don't know how to fix it. Call or text me if you want to know shit is hard to explain. It's not a problem with our code though, it's a problem with the version of mongoose node is installing.

JFrankfurt commented 9 years ago

tried skipping the os type check step and just gave bson an explicit "require('bson');" dependency. Didn't work.

JFrankfurt commented 9 years ago

@alexwaters if you've got a moment this is being freaking annoying.

JFrankfurt commented 9 years ago
C:\Users\Jordan\Google_Drive\DEVWORK\MoonBaseGames\FaucetPage\node_modules\mongodb\node_modules\bson>node     "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-    gyp\bin\node-gyp.js" rebuild 
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.  [C:\Users\Jordan\Google_Drive\DEVWORK\MoonBaseGames\FaucetPage\node_modules\mongodb\node_modules\bson\build\bi    nding.sln]
mongodb@1.4.30 node_modules\mongodb
├── readable-stream@1.0.33 (isarray@0.0.1, string_decoder@0.10.31, inherits@2.0.1, core-util-  is@1.0.1)
├── kerberos@0.0.8 (nan@1.5.1)
└── bson@0.2.18 (nan@1.5.1)
JFrankfurt commented 9 years ago

Maybe a retarded windows thing. Downloading MS Visual Studio so I have a C++ compiler...

PhillipChaffee commented 9 years ago

Finished downloading MS Visual Studio and still got the error. { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version

Fixed that by copying the modified main bson index.js file to not select bson based on processor architecture and instead just require bson.

Then still got the error c:\users\phillip\dropbox\github\moonbasefaucet\models\user.js:4 ObjectId = Schema.ObjectId; ^ ReferenceError: Schema is not defined at Object. (c:\users\phillip\dropbox\github\moonbasefaucet\models \user.js:4:16) 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. (c:\users\phillip\dropbox\github\moonbasefaucet\routes \api.js:6:12) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10)

JFrankfurt commented 9 years ago

Yeah I don't know how, but this is gone.

PhillipChaffee commented 9 years ago

Mine is still doing it so what do you have that I don't.

JFrankfurt commented 9 years ago

Well shoot. Have you made sure you've installed MongoDB properly? That's the one thing I can think of that I did that may have affected this.

It's really confusing to get it right your first time. You have to create a new database folder at your root path.

PhillipChaffee commented 9 years ago

Yeah I just made sure it was all right. Still having the { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' } js-bson: Failed to load c++ bson extension, using pure JS version

problem.

JFrankfurt commented 9 years ago

you pulled down everything I've got up now?

And made sure you can get mongo running in your terminal?

PhillipChaffee commented 9 years ago

If by in terminal you mean in a cmd window running in the test directory or a directory I create then yes. And yeah everything is pulled down.

JFrankfurt commented 9 years ago

https://www.youtube.com/watch?v=c6-K8bpBxxY

everything does this exactly?

PhillipChaffee commented 9 years ago

Yupp exactly

JFrankfurt commented 9 years ago

lfgikhcjxkuhdyzvkiufhdik

PhillipChaffee commented 9 years ago

I have that installed and iojs installed and I install the npm and then try to node index.js. Idk what is wrong.

PhillipChaffee commented 9 years ago

I ran npm update and now that error went away and I am getting a cannot find module mongoose error.

PhillipChaffee commented 9 years ago

$ node index.js { [Error: Cannot find module 'mongoose'] code: 'MODULE_NOT_FOUND' } node.js:668 throw new TypeError('invalid pid'); ^ TypeError: invalid pid at process.kill (node.js:668:15) at process. (c:\Users\Phillip\Dropbox\GitHub\moonbasefaucet\index .js:22:17) at emitOne (events.js:77:13) at process.emit (events.js:166:7) at process._fatalException (node.js:227:26) worker 4212 died 4212 7

PhillipChaffee commented 9 years ago

Reinstalled and rebuilt mongoose with npm.

Now getting this.

$ node index.js { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }

js-bson: Failed to load c++ bson extension, using pure JS version { [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }

js-bson: Failed to load c++ bson extension, using pure JS version [TypeError: Undefined type at password.required Did you try nesting Schemas? You can only nest using refs or arrays.] node.js:668 throw new TypeError('invalid pid'); ^ TypeError: invalid pid at process.kill (node.js:668:15) at process. (c:\Users\Phillip\Dropbox\GitHub\moonbasefaucet\index .js:22:17) at emitOne (events.js:77:13) at process.emit (events.js:166:7) at process._fatalException (node.js:227:26) worker 4436 died 4436 7

PhillipChaffee commented 9 years ago

Can't get past that one googling the error.

PhillipChaffee commented 9 years ago

No luck.

PhillipChaffee commented 9 years ago

It was a password error in the Schema field for mongooses user schemas.

Error: [TypeError: Undefined type at password.required Did you try nesting Schemas? You can only nest using refs or arrays.] node.js:668 throw new TypeError('invalid pid');

Correction: Change user schema password field in user.js

password: { type: String, required: true, index: { unique: true }

JFrankfurt commented 9 years ago

Glad to hear you got it fixed. Ryan and I are in our last few weeks of class over here. Should be able to get going again soon after things slow down for us.