yoonic / atlas

E-Commerce Backend API in Hapi.js and RethinkDB
MIT License
373 stars 104 forks source link

Error after npm run dev - Cannot read property 'error' of undefined #3

Closed JZiebikiewicz closed 7 years ago

JZiebikiewicz commented 7 years ago

I can't run api ( npm run dev ). I get these errors:

> NODE_ENV=development nodemon index | bunyan

[nodemon] 1.9.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index index.js`
/atlas/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126
      if (!option) this.log.error("Unknown option: " + alias + "." + key, ReferenceError);
                           ^

TypeError: Cannot read property 'error' of undefined
    at OptionManager.mergeOptions (/atlas/node_modules/babel-core/lib/transformation/file/options/option-manager.js:126:28)
    at OptionManager.addConfig (/atlas/node_modules/babel-core/lib/transformation/file/options/option-manager.js:107:10)
    at OptionManager.findConfigs (/atlas/node_modules/babel-core/lib/transformation/file/options/option-manager.js:168:35)
    at OptionManager.init (/atlas/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:12)
    at compile (/atlas/node_modules/babel-core/lib/api/register/node.js:117:22)
    at normalLoader (/atlas/node_modules/babel-core/lib/api/register/node.js:199:14)
    at Object.require.extensions.(anonymous function) [as .js] (/atlas/node_modules/babel-core/lib/api/register/node.js:216:7)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
[nodemon] app crashed - waiting for file changes before starting...

Something wrong with babel I think :/

andrecrt commented 7 years ago

@JZiebikiewicz did you follow the install steps in README? What version of node are you using?

JZiebikiewicz commented 7 years ago

@andreftavares yes, I did all steps. I use Node 4.4.5 and npm 2.15.5. Tried also Node 6, but no luck.

Maybe you've got some extra modules installed and not added to package.json? Or maybe we should try babel@6?

andrecrt commented 7 years ago

@JZiebikiewicz i'm running it using Node.js v4.2.5 and NPM v3.5.3. Did you change the version of any package on package.json? What version of babel are you running? npm list babel

JZiebikiewicz commented 7 years ago

No. Just cloned repo, npm installed and followed config instructions. I have Babel 5.8.38.

It must be something wrong with my server. On my laptop (Windows 7 64bit) API works with Node 6.2.2 and Node 4.4.5 too. On server (Ubuntu 14.04 64bit) with none of them. Really weird.

JZiebikiewicz commented 7 years ago

@andreftavares, sooo stupid mistake. I had .babelrc file from another project in parent directory. Like:

/my-project/.babelrc
/my-project/atlas/

That caused all troubles. Sorry for hassle. Your code is correct! :)

BTW, I can't use bcrypt module on Windows. I replaced it with bcrypt-nodejs 0.0.3. Requires changing imports from import bcrypt from 'bcrypt'; to import bcrypt from 'bcrypt-nodejs'; in:

\src\resources\carts\models.js
\src\resources\users\models.js
andrecrt commented 7 years ago

@JZiebikiewicz woah didn't know about that .babelrc scenario, nice catch! Perhaps I'll add that tip to the README :)

In regards to Windows, according to this:

Windows users should make sure to have at least node 0.8.5 installed and version >= 0.7.1 of this module.

<-- So you should be fine, no?

Either way, after replacing the imports, did it work alright?