Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Started - unable to proceed due to errors #74

Open
mystix opened this issue Apr 24, 2014 · 65 comments
Open

Getting Started - unable to proceed due to errors #74

mystix opened this issue Apr 24, 2014 · 65 comments

Comments

@mystix
Copy link
Contributor

mystix commented Apr 24, 2014

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:

> [email protected] 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! [email protected] 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 [email protected] 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?

@mystix mystix changed the title Error running "npm install" -- Warning: Task "uglify" not found. Use --force to continue. Getting Started - can't proceed due to errors Apr 24, 2014
@mystix mystix changed the title Getting Started - can't proceed due to errors Getting Started - unable to proceed due to errors Apr 24, 2014
@robbietapping
Copy link

Im also having the exact same problem, I have been trying to get Moa to work successfully with not much luck.

I did on one machine happen to get the api section working correctly when I did a:

npm install –g [email protected]:[email protected]

From: Marc [mailto:[email protected]]
Sent: Thursday, 24 April 2014 8:41 PM
To: Wildhoney/Magento-on-Angular
Subject: [Magento-on-Angular] Error running "npm install" -- Warning: Task "uglify" not found. Use --force to continue. (#74)

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 getting started instructions, but kept encountering the following error during npm install:

[email protected]:[email protected] 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! [email protected]:[email protected] 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 [email protected]:[email protected] 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 cause 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?


Reply to this email directly or view it on GitHubhttps://github.com//issues/74.

@Wildhoney
Copy link
Owner

I'll take a look at the other errors, but in the meantime your last error is caused by a misconfiguration in the API. Please take a look at the API path for any Magento errors: http://api.magento/api/public/attributes/color where api.magento is whatever your URL is as defined in your config.json file.

@Wildhoney
Copy link
Owner

I've just done a git clone of the repository, and successfully ran an npm install.

Which version of node are you folks using?

Adams-MacBook-Pro-1449:server Wildhoney$ node -v
v0.10.25

@mystix
Copy link
Contributor Author

mystix commented Apr 24, 2014

➜  ~  node -v   
v0.10.26

➜  ~  npm -v   
1.4.7

I'm running an OSX 10.9.2 box.

@robbietapping
Copy link

I am running v0.10.26

Im also trying to run this off a windows box….. smack

@Wildhoney
Copy link
Owner

No problem! It should still work fine. Please update your branches and try another npm install.

@mystix
Copy link
Contributor Author

mystix commented Apr 24, 2014

@Wildhoney Updated. npm install runs fine, but now I get the following error when running node node/server.js:

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

module.js:340
    throw err;
          ^
Error: Cannot find module 'node-snapshot'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function._load (/Users/mystix/git/Magento-on-Angular/node_modules/newrelic/lib/shimmer.js:209:38)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/mystix/git/Magento-on-Angular/node/server.js:6:19)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

@mystix
Copy link
Contributor Author

mystix commented Apr 24, 2014

@Wildhoney I'm also unsure of how to configure config.json. This is what I have at the moment:

{
    "socket": {
        "port": 8888,·
        "host": "localhost"
    },   
    "magento": {
        "path": "/Users/mystix/git/mageplus",
        "host": "http://mageplus.dev",
        "store": 0
    },   
    "api": {
        "host": "http://mageplus.dev/api", // what URL should I use here??
        "provider": "magento"
    }    
}

what URL should I use for the api host?

@Wildhoney
Copy link
Owner

Sorry, there was a problem with my Snapshot module. I've pushed an update, and also updated the package.json, so everything should work okay now.

For the API path http://mageplus.dev/api is fine if that resolves to api/public from Moa.

@mystix
Copy link
Contributor Author

mystix commented Apr 24, 2014

Thanks for the quick fixes @Wildhoney. npm install && bower install works fine now.

I'm running into a different error now with node node/server.js:

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

SyntaxError: Unexpected token <
    at Object.parse (native)
    at Request._callback (/Users/mystix/git/Magento-on-Angular/node/server.js:24:21)
    at Request.self.callback (/Users/mystix/git/Magento-on-Angular/node_modules/request/request.js:122:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/Users/mystix/git/Magento-on-Angular/node_modules/request/request.js:888:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/Users/mystix/git/Magento-on-Angular/node_modules/request/request.js:839:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at /Users/mystix/git/Magento-on-Angular/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31

Tried it with the following config.json configs:

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

and

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

but no dice with either config.

p.s. Could you explain how one would go about defining

    "api": {
        "host": <what goes here???>,

@Wildhoney
Copy link
Owner

It needs to be the URL that resolves to the API. If you can get your API endpoints working, then the above config is all fine and dandy.

If you navigate to http://mageplus.dev/api/public/attributes/color they'll be a Magento error of some kind.

@mystix
Copy link
Contributor Author

mystix commented Apr 24, 2014

Navigating to http://mageplus.dev/api/public/attributes/color just throws a stock magento 404 error page. =(

Is that API endpoint supposed to point to Magento's XML-RPC / REST endpoints?
(I'm really sorry -- I can't seem to find any documentation / note about what API endpoint is supposed to go into config.json).

If it helps, I'm running Magento 1.7.0.0.

[edit]
Ok managed to find this:
https://github.com/Wildhoney/Magento-on-Angular/wiki/Preferred-Folder-Structure-and-Config

Will attempt to reconfigure nginx and config.json and report back again.

@robbietapping
Copy link

OK so i keep on hitting the same blocker.

remembering i am running php on windows via iis8.5

im hitting this problem when I run

$ composer install

from the api's directory.

this is my config.json file by the way.

{
"socket": {
"port": 8888,
"host": "localhost"
},
"magento": {
"path": "C:\inetpub\wwwroot\magento",
"host": "http://localhost/magento",
"store": 0
},
"api": {
"host": "http://localhost/Magento-on-Angular/api/public",
"provider": "magento"
}
}

C:\inetpub\wwwroot\Magento-on-Angular\api>composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
PHP Fatal error: Class '\Moa\API\Provider\Provider' not found in C:\inetpub\www
root\Magento-on-Angular\api\app\classes\Moa\Laravel\APIServiceProvider.php on li
ne 34
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","me
ssage":"Class '\Moa\API\Provider\Provider' not found","file":"C:\inetpub\w
wwroot\Magento-on-Angular\api\app\classes\Moa\Laravel\APIServiceProvider.
php","line":34}}Script php artisan optimize handling the post-install-cmd event
returned with an error

[RuntimeException]
Error Output: PHP Fatal error: Class '\Moa\API\Provider\Provider' not foun
d in C:\inetpub\wwwroot\Magento-on-Angular\api\app\classes\Moa\Laravel\APIS
erviceProvider.php on line 34

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-p
lugins] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--ver
bose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

C:\inetpub\wwwroot\Magento-on-Angular\api>

How do the relative paths to the magento source work on windows?

Thanks in advance.

@mystix
Copy link
Contributor Author

mystix commented Apr 24, 2014

Thanks @Wildhoney. Managed to get things (mostly) up and running once I set things up using
https://github.com/Wildhoney/Magento-on-Angular/wiki/Preferred-Folder-Structure-and-Config

I'm now running into a separate error when loading the moa store:
screen shot 2014-04-24 at 8 24 29 pm

My virtual hosts are setup as follows:

(VirtualHost) mageplus.dev
doc_root -> /Users/mystix/git/mageplus

(VirtualHost) api.moa.dev
doc_root -> /Users/mystix/git/Magento-on-Angular/api/public

(VirtualHost) moa.dev
doc_root -> /Users/mystix/git/Magento-on-Angular/store

and my config.json as follows:

{
    "socket": {
        "port": 8888, 
        "host": "moa.dev"
    },
    "magento": {
        "path": "/Users/mystix/git/mageplus",
        "host": "http://mageplus.dev",
        "store": 0
    },
    "api": {
        "host": "http://api.moa.dev",
        "provider": "magento"
    }
}

@aonic
Copy link
Collaborator

aonic commented Apr 24, 2014

It appears there was an oversight in my preferred vhost setup. The ./bower_components are currently being downloaded to /Users/mystix/git/Magento-on-Angular/bower_components but the vhost doesn't have access to them.

A temporary solution is for you to:

cd /Users/mystix/git/Magento-on-Angular/store
ln -s ../bower_components

@Wildhoney what do you think is a good permanent solution? Should bower_components be downloaded under /store/?

@Dijkie
Copy link

Dijkie commented Apr 24, 2014

For testing I did copied the bower_components into /store/ and index.html is loading all scripts now.

Only the api request are not working.
I did tried to reach the api by postman ass well but return 500 error.

@mystix
Copy link
Contributor Author

mystix commented Apr 24, 2014

@aonic Yep -- I've done that (cd /Users/mystix/git/Magento-on-Angular/store && ln -s ../bower_components), as well as modified store/index.html as follows:

    <link rel="stylesheet" href="bower_components/skeleton/stylesheets/base.css" />
    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />

    <script src="bower_components/jquery/dist/jquery.js"></script>
    <script src="bower_components/angular/angular.js"></script>
    <script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
    <script src="bower_components/underscore/underscore.js"></script>
    <script src="bower_components/hammerjs/hammer.js"></script>
    <script src="bower_components/socket.io-client/dist/socket.io.js"></script>

Note: the path to jquery is also incorrect (already corrected in the code snippet above).
It should be bower_components/jquery/dist/jquery.js.

@Dijkie
Copy link

Dijkie commented Apr 24, 2014

Keep running in this error....

Acer@ACER-PC /c/xampp/htdocs/Magento-on-Angular (master)
$ node node/server.js

SyntaxError: Unexpected token <
at Object.parse (native)
at Request._callback (c:\xampp\htdocs\Magento-on-Angular\node\server.js:24:21)
at Request.self.callback (c:\xampp\htdocs\Magento-on-Angular\node_modules\request\request.js:122
:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request. (c:\xampp\htdocs\Magento-on-Angular\node_modules\request\request.js:888:1
4)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (c:\xampp\htdocs\Magento-on-Angular\node_modules\request\request.
js:839:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at c:\xampp\htdocs\Magento-on-Angular\node_modules\newrelic\node_modules\continuation-local-stor
age\node_modules\async-listener\glue.js:177:31

@aonic
Copy link
Collaborator

aonic commented Apr 24, 2014

@robbietapping unfortunately I do not have an IIS environment to test. What PHP version are you using? take a look at https://github.com/Wildhoney/Magento-on-Angular/blob/master/api/app/classes/Moa/API/Provider/MagentoProvider.php#L32 to see how the Magento path is used.

@Dijkie what is the api.host value for your config.json file? What do you see when you go to http://$api_host/products in your browser?

@Dijkie
Copy link

Dijkie commented Apr 24, 2014

www.api.example.com

Vhost:

<VirtualHost *:80>
##ServerAdmin [email protected]
DocumentRoot C:/xampp/htdocs/Magento-on-Angular/api/public
ServerName api.example.com
ServerAlias www.api.example.com
<Directory "C:\xampp\htdocs\Magento-on-Angular\api\public">
Order allow,deny
Allow from all

##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common

@Dijkie
Copy link

Dijkie commented Apr 24, 2014

VirtualHost *:80
##ServerAdmin [email protected]
DocumentRoot C:/xampp/htdocs/Magento-on-Angular/api/public
ServerName api.example.com
ServerAlias www.api.example.com
Directory "C:\xampp\htdocs\Magento-on-Angular\api\public"
Order allow,deny
Allow from all
Directory
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
VirtualHost

@aonic
Copy link
Collaborator

aonic commented Apr 24, 2014

Here is an example of what you should see when you go to http://$api_host/products

http://moa.cloud-ops.net/api/public/products

@Dijkie
Copy link

Dijkie commented Apr 24, 2014

Getting 500 error

@aonic
Copy link
Collaborator

aonic commented Apr 24, 2014

What does your apache error log say?

@Dijkie
Copy link

Dijkie commented Apr 24, 2014

[Thu Apr 24 17:16:06.381510 2014] [core:alert] [pid 8664:tid 1668] [client 127.0.0.1:60572] C:/xampp/htdocs/Magento-on-Angular/api/public/.htaccess: Invalid command 'AddOutputFilterByType', perhaps misspelled or defined by a module not included in the server configuration

@Dijkie
Copy link

Dijkie commented Apr 24, 2014

And bu executing node/node server.js this one.

$ node node/server.js

SyntaxError: Unexpected token <
at Object.parse (native)
at Request._callback (c:\xampp\htdocs\Magento-on-Angular\node\server.js:24:21)
at Request.self.callback (c:\xampp\htdocs\Magento-on-Angular\node_modules\request\request.js:122
:22)
at Request.EventEmitter.emit (events.js:98:17)
at Request. (c:\xampp\htdocs\Magento-on-Angular\node_modules\request\request.js:888:1
4)
at Request.EventEmitter.emit (events.js:117:20)
at IncomingMessage. (c:\xampp\htdocs\Magento-on-Angular\node_modules\request\request.
js:839:12)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at c:\xampp\htdocs\Magento-on-Angular\node_modules\newrelic\node_modules\continuation-local-stor
age\node_modules\async-listener\glue.js:177:31

@Dijkie
Copy link

Dijkie commented Apr 24, 2014

image

@Dijkie
Copy link

Dijkie commented Apr 24, 2014

Why the errors show up in the network inspector?

@mystix
Copy link
Contributor Author

mystix commented Apr 24, 2014

@Dijkie Because CORS has not been enabled on the domain api.example.com (see http://en.wikipedia.org/wiki/Cross-origin_resource_sharing).

Because XHR requests from the domain www.example.com are being made to the domain api.example.com.

@Wildhoney
Copy link
Owner

I'm currently overloaded with tasks, but will hopefully get an opportunity in the next half an hour to add this 👍

@Dijkie
Copy link

Dijkie commented Apr 24, 2014

Ok...Do I need to set this header in the vhost?

@Wildhoney
Copy link
Owner

Yep, try adding Header set Access-Control-Allow-Origin * to your vhost.

@Dijkie
Copy link

Dijkie commented Apr 27, 2014

Hi again!

First of all thanks for all the help!

Like you set I did changed my vhost like this

MOA virtual hosts

magento.example.com

VirtualHost :80
##ServerAdmin [email protected]
DocumentRoot C:/xampp/htdocs/magento
ServerName magento.example.com
ServerAlias www.magento.example.com
Header add Access-Control-Allow-Origin "
"
Directory "C:\xampp\htdocs\magento"
Order allow,deny
Allow from all
Directory
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
VirtualHost

api.example.com

VirtualHost :80
##ServerAdmin [email protected]
DocumentRoot C:/xampp/htdocs/Magento-on-Angular/api/public
ServerName api.example.com
ServerAlias www.api.example.com
Header add Access-Control-Allow-Origin "
"
Directory "C:\xampp\htdocs\Magento-on-Angular\api\public"
Order allow,deny
Allow from all
Directory
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
VirtualHost

example.com

VirtualHost :80
##ServerAdmin [email protected]
DocumentRoot C:/xampp/htdocs/Magento-on-Angular/store
ServerName www.example.com
ServerAlias example.com
Header add Access-Control-Allow-Origin "
"
Directory "C:\xampp\htdocs\Magento-on-Angular\store"
Order allow,deny
Allow from all
Directory
##ErrorLog "logs/dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.com-access.log" common
VirtualHost

Like I said the api is working but when I try to register as a user nothing happens....

I did a lot of reading about socket.io and express and there's a lot written of setting this in the server file?

Does this need to be set here as well?

Regards Martijn

@Dijkie
Copy link

Dijkie commented Apr 27, 2014

Forget the say:

I don't see the Header add Access-Control-Allow-Origin "" coming back in the response headers when I inspect www.example.com

@robbietapping
Copy link

Have you tried running MOA off IIS? I've successfully got Magento/MOA running off IIS 8 flawlessly!

If you need contributors for MOA let me know I would be keen to give some resources.

@Dijkie - I owe you one, your document root example for your config.json was what ended my 3 hour pain of working out why MOA would not compile.

Sent from my iPhone

On 27 Apr 2014, at 23:07, "Dijkie" <[email protected]mailto:[email protected]> wrote:

Hi again!

First of all thanks for all the help!

Like you set I did changed my vhost like this

MOA virtual hosts
magento.example.comhttp://magento.example.com

VirtualHost :80
##ServerAdmin [email protected]:[email protected]
DocumentRoot C:/xampp/htdocs/magento
ServerName magento.example.comhttp://magento.example.com
ServerAlias www.magento.example.comhttp://www.magento.example.com
Header add Access-Control-Allow-Origin ""
Directory "C:\xampp\htdocs\magento"
Order allow,deny
Allow from all
Directory
##ErrorLog "logs/dummy-host.example.comhttp://dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.comhttp://dummy-host.example.com-access.log" common
VirtualHost

api.example.comhttp://api.example.com

VirtualHost :80
##ServerAdmin [email protected]:[email protected]
DocumentRoot C:/xampp/htdocs/Magento-on-Angular/api/public
ServerName api.example.comhttp://api.example.com
ServerAlias www.api.example.comhttp://www.api.example.com
Header add Access-Control-Allow-Origin ""
Directory "C:\xampp\htdocs\Magento-on-Angular\api\public"
Order allow,deny
Allow from all
Directory
##ErrorLog "logs/dummy-host.example.comhttp://dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.comhttp://dummy-host.example.com-access.log" common
VirtualHost

example.comhttp://example.com

VirtualHost :80
##ServerAdmin [email protected]:[email protected]
DocumentRoot C:/xampp/htdocs/Magento-on-Angular/store
ServerName www.example.comhttp://www.example.com
ServerAlias example.comhttp://example.com
Header add Access-Control-Allow-Origin ""
Directory "C:\xampp\htdocs\Magento-on-Angular\store"
Order allow,deny
Allow from all
Directory
##ErrorLog "logs/dummy-host.example.comhttp://dummy-host.example.com-error.log"
##CustomLog "logs/dummy-host.example.comhttp://dummy-host.example.com-access.log" common
VirtualHost

Like I said the api is working but when I try to register as a user nothing happens....

I did a lot of reading about socket.io and express and there's a lot written of setting this in the server file?

Does this need to be set here as well?

Regards Martijn

Reply to this email directly or view it on GitHubhttps://github.com//issues/74#issuecomment-41496081.

@Dijkie
Copy link

Dijkie commented Apr 27, 2014

@ robbietapping it's mister Wildhoney his project :) and I try to learn from him.

But thanks for the thanks anyway 👍 :)

I never tried IIS, I'm happy for now starting to understand apache

@CapnMigraine
Copy link

Hi, I'm getting the following error after running node node/server.js:

undefined:1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
^
SyntaxError: Unexpected token <
    at Object.parse (native)
    at Request._callback (/var/www/moa/node/server.js:24:21)
    at Request.self.callback (/var/www/moa/node_modules/request/request.js:122:22)
    at Request.EventEmitter.emit (events.js:110:17)
    at Request.<anonymous> (/var/www/moa/node_modules/request/request.js:888:14)
    at Request.EventEmitter.emit (events.js:129:20)
    at IncomingMessage.<anonymous> (/var/www/moa/node_modules/request/request.js:839:12)
    at IncomingMessage.EventEmitter.emit (events.js:129:20)
    at _stream_readable.js:898:16
    at /var/www/moa/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:177:31

Here's the contents of my config.json file, as suggested in the wiki:

{
    "socket": {
        "port": "8888",
        "host": "www.example.com"
    },
    "magento": {
        "path": "/var/www/magento",
        "host": "http://magento.example.com",
        "store": "0"
    },
    "api": {
        "host": "http://api.example.com",
        "provider": "magento"
    }
}

Also, the config of my vhost files

Magento

ServerName magento.example.com
ServerAlias magento.example.com
DocumentRoot /var/www/magento

MoA

ServerName www.example.com 
ServerAlias www.example.com 
DocumentRoot /var/www/moa/store

API

ServerName api.example.com
ServerAlias api.example.com
DocumentRoot /var/www/moa/api/public

Has anyone experienced the same issue?

Cheers

@aonic
Copy link
Collaborator

aonic commented Jul 23, 2014

try going to api.example.com/products -- what do you see?

@aonic
Copy link
Collaborator

aonic commented Jul 23, 2014

Also, what do you see in your apache error log?

@CapnMigraine
Copy link

This is what I see in api.example.com/products:

The requested URL /products was not found on this server

api.example.com does load, though. Here's a screenshot of the output:

output

@aonic
Copy link
Collaborator

aonic commented Jul 23, 2014

The laravel storage folder needs proper write permissions for the web server user.

Sent from my phone

On Jul 22, 2014, at 10:32 PM, red5code [email protected] wrote:

This is what I see in api.example.com/products:

The requested URL /products was not found on this server

api.example.com does load, though. Here's a screenshot of the output:


Reply to this email directly or view it on GitHub.

@CapnMigraine
Copy link

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

@aonic
Copy link
Collaborator

aonic commented Jul 23, 2014

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

@CapnMigraine
Copy link

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
Copy link
Collaborator

aonic commented Jul 24, 2014

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

@CapnMigraine
Copy link

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
Copy link
Collaborator

aonic commented Jul 24, 2014

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 [email protected] 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
#74 (comment)
.

@CapnMigraine
Copy link

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
Copy link

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

@aonic
Copy link
Collaborator

aonic commented Jul 25, 2014

👍

@pateldixit26692
Copy link

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
Copy link

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
Copy link

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
Copy link
Owner

_ being undefined is due to the Underscore dependency not being included 👍

@dixitxhtmljunkies
Copy link

Thank you @Wildhoney

Its working now !

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

@Wildhoney
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants