Wildhoney / Magento-on-Angular

Angular.js application using Magento as the backend API
360 stars 120 forks source link

Getting Started - unable to proceed due to errors #74

Open mystix opened 10 years ago

mystix commented 10 years ago

I'm running node 0.10.26 + npm 1.4.7 (installed using mxcl/homebrew) on OSX 10.9.2.

Tried to get moa up and running using the instructions from the Getting Started section of the README, but kept encountering the following error during npm install:

> node-snapshot@0.3.15 postinstall /Users/mystix/git/Magento-on-Angular/node_modules/node-snapshot
> node_modules/bower/bin/bower install && node_modules/grunt-cli/bin/grunt build:production

>> Local Npm module "grunt-contrib-uglify" not found. Is it installed?
>> Local Npm module "grunt-contrib-jshint" not found. Is it installed?
Warning: Task "uglify" not found. Use --force to continue.

Aborted due to warnings.
npm ERR! node-snapshot@0.3.15 postinstall: `node_modules/bower/bin/bower install && node_modules/grunt-cli/bin/grunt build:production`
npm ERR! Exit status 3
npm ERR! 
npm ERR! Failed at the node-snapshot@0.3.15 postinstall script.
npm ERR! This is most likely a problem with the node-snapshot package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node_modules/bower/bin/bower install && node_modules/grunt-cli/bin/grunt build:production
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-snapshot
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.1.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/mystix/git/Magento-on-Angular
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.7
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/mystix/git/Magento-on-Angular/npm-debug.log
npm ERR! not ok code 0

Managed to workaround this by changing the dependencies list in package.json to:

    // .... 

    "node-snapshot": "0.3.10" // anything >= 0.3.11 causes npm install to fail
  }
}

then tried to Initialise the Node.js instance: node node/server.js; but encountered the following error:

➜  Magento-on-Angular git:(master) ✗ node node/server.js                                 

SyntaxError: Unexpected token u
    at Object.parse (native)
    at Request._callback (/Users/mystix/git/Magento-on-Angular/node/server.js:24:21)
    at self.callback (/Users/mystix/git/Magento-on-Angular/node_modules/request/request.js:122:22)
    at Request.EventEmitter.emit (events.js:95:17)
    at ClientRequest.self.clientErrorHandler (/Users/mystix/git/Magento-on-Angular/node_modules/request/request.js:231:10)
    at ClientRequest.EventEmitter.emit (events.js:95:17)
    at Socket.socketErrorListener (http.js:1547:9)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:440:14
    at /Users/mystix/git/Magento-on-Angular/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31

Any ideas what I'm doing wrong?

CapnMigraine commented 10 years ago

Thanks, I fixed that. I keep getting the same error from node.js, though. Also, still can't find api.example.com/products

aonic commented 10 years ago

What do you see when you go to the /products page?

CapnMigraine commented 10 years ago

I was able to make the /products page work, by tweaking the vhost files.

I can see the product JSON string now. However, running node node/service.js I still throws the following error:

node node/server.js                                                                                                                                                                                   !337

SyntaxError: Unexpected token u
    at Object.parse (native)
    at Request._callback (/var/www/moa/node/server.js:24:21)
    at self.callback (/var/www/moa/node_modules/request/request.js:122:22)
    at Request.emit (events.js:95:17)
    at ClientRequest.self.clientErrorHandler (/var/www/moa/node_modules/request/request.js:231:10)
    at ClientRequest.emit (events.js:95:17)
    at Socket.socketErrorListener (http.js:1547:9)
    at Socket.emit (events.js:95:17)
    at net.js:833:16
    at /var/www/moa/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31

Any ideas?

aonic commented 10 years ago

Does your node server know how to resolve api.example.com to the correct IP?

CapnMigraine commented 10 years ago

Yes, it's working now. I can see the products in the store page.

I'm having a slightly different issue now. When the page loads, there are some requests that are failing.

You can see them in the image below

output

I installed MoA on a VM, so I'm redirecting port 8080 on the host to port 80 on the guest.

If I access to GET http://api.dev:8080/basket, for example, it works. How can I set that internally so those requests are made through port 8080 instead of 80?

aonic commented 10 years ago

You can edit the config.json to add :8080 to the URLs -- let me know if that works

Raja Kapur

On Thu, Jul 24, 2014 at 12:39 PM, red5code notifications@github.com wrote:

Yes, it's working now. I can see the products in the store page.

I'm having a slightly different issue now. When the page loads, there are some requests that are failing.

You can see them in the image below

[image: output] https://camo.githubusercontent.com/a7511ad3ff4d727dc2289d9a6d4d6809a6c3a25c/687474703a2f2f662e636c2e6c792f6974656d732f31413376325a3071333530323238306a326d32572f496d616765253230323031342d30372d3234253230617425323031302e33352e3031253230414d2e706e67

I installed MoA on a VM, so I'm redirecting port 8080 on the host to port 80 on the guest.

If I access to GET http://api.dev:8080/basket, for example, it works. How can I set that internally so those requests are made through port 8080 instead of 80?

— Reply to this email directly or view it on GitHub https://github.com/Wildhoney/Magento-on-Angular/issues/74#issuecomment-50044035 .

CapnMigraine commented 10 years ago

When I add the port to the api host value like this:

"api": { "host": "http://api.dev:8080", "provider": "magento" }

I start getting the "Unexpected token u" error from node again. That happens because the request to get the products in the node server fails (since locally it's accessing the url through port 80)

CapnMigraine commented 10 years ago

I added a new vhost to answer requests through port 8080 and now it's working. Thanks for your help @aonic!

aonic commented 10 years ago

:+1:

pateldixit26692 commented 10 years ago

I am getting this error

SyntaxError: Unexpected token D at Object.parse (native) at Request._callback (D:\xampp\htdocs\ang\node\server.js:24:21) at Request.self.callback (D:\xampp\htdocs\ang\node_modules\request\request.j s:122:22) at Request.EventEmitter.emit (events.js:98:17) at Request. (D:\xampp\htdocs\ang\node_modules\request\request.js: 888:14) at Request.EventEmitter.emit (events.js:117:20) at IncomingMessage. (D:\xampp\htdocs\ang\node_modules\request\req uest.js:839:12) at IncomingMessage.EventEmitter.emit (events.js:117:20) at _stream_readable.js:910:16 at D:\xampp\htdocs\ang\node_modules\newrelic\node_modules\continuation-local -storage\node_modules\async-listener\glue.js:177:31

Please suggest solutions.

puzzlemonkey commented 10 years ago

Hi, I am also getting the "SyntaxError: Unexpected token <" error when trying to run node/server.js, full error here:

SyntaxError: Unexpected token < at Object.parse (native) at Request._callback (/var/www/html/moa/node/server.js:24:21) at Request.self.callback (/var/www/html/moa/node_modules/request/request.js:122:22) at Request.emit (events.js:98:17) at Request. (/var/www/html/moa/node_modules/request/request.js:888:14) at Request.emit (events.js:117:20) at IncomingMessage. (/var/www/html/moa/node_modules/request/request.js:839:12) at IncomingMessage.emit (events.js:117:20) at _stream_readable.js:943:16 at /var/www/html/moa/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31

However when I hit api.example.com i get this php error, which is also in the apache logs:

Warning: require(/var/www/html/moa/api/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/moa/api/bootstrap/autoload.php on line 17

Fatal error: require(): Failed opening required '/var/www/html/moa/api/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/moa/api/bootstrap/autoload.php on line 17

from apache:

[Wed Sep 10 16:28:07.915658 2014] [:error] [pid 30558] [client 127.0.0.1:33668] PHP Warning: require(/var/www/html/moa/api/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/moa/api/bootstrap/autoload.php on line 17

what is this /vender/autoload.php about?

Any help would be appreciated.

dixitxhtmljunkies commented 9 years ago

Hi, Getting following error:

Error: _ is not defined resolve@http://localhost/Fast/Magento-on-Angular/store/js/services/Gateway.js:36:13 contentUpdated/<@http://localhost/Fast/Magento-on-Angular/store/js/controllers/ProductsController.js:147:35 $RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost/Fast/Magento-on-Angular/store/bower_components/angular/angular.js:12811:16 $RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost/Fast/Magento-on-Angular/store/bower_components/angular/angular.js:12909:18 contentUpdated@http://localhost/Fast/Magento-on-Angular/store/js/controllers/ProductsController.js:143:13 EventEmitter.prototype.emit@http://localhost/Fast/Magento-on-Angular/store/bower_components/socket.io-client/dist/socket.io.js:633:7 SocketNamespace.prototype.onPacket@http://localhost/Fast/Magento-on-Angular/store/bower_components/socket.io-client/dist/socket.io.js:2248:9 Socket.prototype.onPacket@http://localhost/Fast/Magento-on-Angular/store/bower_components/socket.io-client/dist/socket.io.js:1930:5 Transport.prototype.onPacket@http://localhost/Fast/Magento-on-Angular/store/bower_components/socket.io-client/dist/socket.io.js:1332:5 Transport.prototype.onData@http://localhost/Fast/Magento-on-Angular/store/bower_components/socket.io-client/dist/socket.io.js:1303:11 WS.prototype.open/this.websocket.onmessage@http://localhost/Fast/Magento-on-Angular/store/bower_components/socket.io-client/dist/socket.io.js:2378:7

http://localhost/Fast/Magento-on-Angular/store/bower_components/angular/angular.js Line 10126

Have a look in attached screenshot ! magento-angular-js-error

Wildhoney commented 9 years ago

_ being undefined is due to the Underscore dependency not being included :+1:

dixitxhtmljunkies commented 9 years ago

Thank you @Wildhoney

Its working now !

Currently code wrote upto cart. No logic for checkout right ?

Wildhoney commented 9 years ago

Sadly that's right – any pull requests relating to checkout gleefully merged!