Closed nash90 closed 8 years ago
Hi,
First of all thanks for your support! Looking forward to hear your thoughts after you get it working :)
I see from the log you posted above that you're running node v6.4.0 and npm v3.10.3. Can you try with node v4.x LTS? (I have it running in node.js v4.2.5 and npm v.3.5.3)
You can use something like https://github.com/creationix/nvm to switch between node.js versions.
Hope it helps! Looking forward to your feedback.
@nash90 any luck? :)
@andreftavares Thank you very much for your response. I was able to run it after installing bcrypt manually. I also had to install sass manually npm install bcrypt@0.8.7 npm install node-sass@3.5.3
now i am trying to run atlas locally but getting some cross origin related issue. Again thanks for this wonderful project and sharing your knowledge.
@nash90 thanks for your answer! Will test those versions and perhaps update the requirements.
In regards to the "cross origin" issue, can you provide more details?
@andreftavares The actual issue occurred when I was using atlas and nicistore simultaneously locally. nicistore failed to call apis in atlas. The javascript console log for nicistore app is attached. The error message is "XMLHttpRequest cannot load http://localhost:8000/api/v1/account. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404."
In my understanding as nicistore is hosted in localhost:3000 domain and api is in localhost:8000 domain, when nicistore calls the atlas api there is "No access-control-allow-origin header is present in the resource" issue.
I was wondering how you solve above issue. Regards,
@nash90 did you try running your local Storefront (nicistore) first against the Live Nicistore API and then switching to your local install of Atlas?
Because, from what I can tell, your local install of the Storefront is looking for the API base URL in http://localhost:8000/api/v1. If you're running the default development settings of Atlas, it is exposing the API in base URL http://localhost:8000/v1 (notice the lack of "/api" prefix) <-- Change the settings in the Storefront for this value instead (link)
In the production site nicistore.com, since I'm running both apps (storefront and backend) under the same domain, I opted by mounting the API in the prefix "/api" of the domain, thus the base URL being "https://nicistore.com/api/v1" (link)
Hope this helps!
I've updated nicistore's readme to better explain this scenario (link) please tell me if you think it more clear :)
@andreftavares After I changed the API base URL to http://localhost:8000/v1, it worked. Thank you so much. However, I didnt understand the reason of access-control-allow-origin error for earlier case.
I noticed that the response has following header this time when it worked which I think was not present in earlier case. access-control-allow-origin:http://localhost:3000
Does that mean the api is specially set to add above header in response for all requests. It would really help me to study this behaviour if could give me link to that portion of code.
@andreftavares By the way, thanks for updating readme. Its very clear now.
@nash90 if you look closely, the issue is that the URL (http://localhost:8000/api/v1) simply does not exist and the API is returning a 404 Not Found :) I'm guessing that Hapi.js simply does not return CORS headers in the case of unexisting routes, thus the CORS message.
Indeed it can lead to misunderstandings... I got used to it, never did much research on the matter!
In Atlas, I configure Hapijs's CORS here https://github.com/yoonic/atlas/blob/master/src/server.js#L32-L35 and you can dig a little further in Hapij's documentation here http://hapijs.com/api
@andreftavares Thanks for the info.
Hello,
Thanks for sharing this amazing project. I wanted to try and run this locally. But I encountered following issue. let me know if you have any idea about. I am new to node.
Nash:atlas abinash$ npm install
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o ./Release/.deps/Release/obj.target/bcrypt_lib/src/blowfish.o.d.raw { dev: 16777220, mode: 33188, nlink: 1, uid: 501, gid: 20, rdev: 0, blksize: 4096, ino: 37968779, size: 87, blocks: 8, atime: 2016-09-01T04:31:13.000Z, mtime: 2016-09-01T04:31:13.000Z, ctime: 2016-09-01T04:31:13.000Z, birthtime: 2016-09-01T04:31:13.000Z } CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o ./Release/.deps/Release/obj.target/bcrypt_lib/src/bcrypt.o.d.raw { dev: 16777220, mode: 33188, nlink: 1, uid: 501, gid: 20, rdev: 0, blksize: 4096, ino: 37968782, size: 83, blocks: 8, atime: 2016-09-01T04:31:13.000Z, mtime: 2016-09-01T04:31:13.000Z, ctime: 2016-09-01T04:31:13.000Z, birthtime: 2016-09-01T04:31:13.000Z } CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o In file included from ../src/bcrypt_node.cc:1: ../node_modules/nan/nan.h:592:20: error: no type named 'GCEpilogueCallback' in 'v8::Isolate' v8::Isolate::GCEpilogueCallback callback