Open mystix opened 10 years ago
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 node-snapshot@0.3.8mailto:node-snapshot@0.3.8
From: Marc [mailto:notifications@github.com] 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:
node-snapshot@0.3.15mailto: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.15mailto: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.11mailto:node-snapshot@0.3.11 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/Wildhoney/Magento-on-Angular/issues/74.
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.
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
➜ ~ node -v
v0.10.26
➜ ~ npm -v
1.4.7
I'm running an OSX 10.9.2 box.
I am running v0.10.26
Im also trying to run this off a windows box….. smack
No problem! It should still work fine. Please update your branches and try another npm install
.
@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)
@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?
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.
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???>,
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.
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.
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.
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:
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"
}
}
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/
?
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.
@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
.
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.
@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?
www.api.example.com
Vhost:
<VirtualHost *:80>
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
##CustomLog "logs/dummy-host.example.com-access.log" common
VirtualHost *:80
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
##CustomLog "logs/dummy-host.example.com-access.log" common
VirtualHost
Here is an example of what you should see when you go to http://$api_host/products
Getting 500 error
What does your apache error log say?
[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
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.
@Dijkie looks like your apache install is missing some modules (mod deflate and filter, I think)
We need to include a .bowerrc
file in the root directory to move the bower_components
directory into the web root. Will do this later on today :+1:
@ aonic
Just swithed both on....
Now apache error:
[Thu Apr 24 17:31:45.225209 2014] [ssl:warn] [pid 3516:tid 260] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name [Thu Apr 24 17:31:45.293212 2014] [core:warn] [pid 3516:tid 260] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? [Thu Apr 24 17:31:45.570228 2014] [ssl:warn] [pid 3516:tid 260] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name [Thu Apr 24 17:31:45.629232 2014] [mpm_winnt:notice] [pid 3516:tid 260] AH00455: Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.9 configured -- resuming normal operations [Thu Apr 24 17:31:45.629232 2014] [mpm_winnt:notice] [pid 3516:tid 260] AH00456: Apache Lounge VC11 Server built: Nov 21 2013 20:13:01 [Thu Apr 24 17:31:45.629232 2014] [core:notice] [pid 3516:tid 260] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/xampp/apache' [Thu Apr 24 17:31:45.633232 2014] [mpm_winnt:notice] [pid 3516:tid 260] AH00418: Parent: Created child process 7544 [Thu Apr 24 17:31:46.763297 2014] [ssl:warn] [pid 7544:tid 272] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name [Thu Apr 24 17:31:47.137318 2014] [ssl:warn] [pid 7544:tid 272] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name [Thu Apr 24 17:31:47.194321 2014] [mpm_winnt:notice] [pid 7544:tid 272] AH00354: Child: Starting 150 worker thread
And laravel....
@Dijkie try api.example.com/products -- what do you see? Also, can you show me the contents of your config.json
Get the products.json .... :)
config.json:
{ "socket": { "port": 8888, "host": "www.example.com" }, "magento": { "path": "C:/xampp/htdocs/magento", "host": "http://magento.example.com", "store": 0 }, "api": { "host": "http://api.example.com", "provider": "magento" } }
Everything looks good, you should be able to start node now
All the api request work in postman :) As well when I request in the browser :)
Node is starting as well now!!!
http://www.example.com is showing the products as well !
Only when I inspect get still the api errors like underneath...
I don't get what was the node problem :(
Might be a CORS issue, we might need to specify header("Access-Control-Allow-Origin: *");
in Node. Will take a look at this later tonight.
There wasn't an issue with Node, but rather with the API call. At the moment the Node API doesn't gracefully fail if the API isn't playing ball.
Why the errors show up in the network inspector?
@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.
I'm currently overloaded with tasks, but will hopefully get an opportunity in the next half an hour to add this :+1:
Ok...Do I need to set this header in the vhost?
Yep, try adding Header set Access-Control-Allow-Origin *
to your vhost.
Hi again!
First of all thanks for all the help!
Like you set I did changed my vhost like this
VirtualHost _:80
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
##CustomLog "logs/dummy-host.example.com-access.log" common
VirtualHost
VirtualHost _:80
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
##CustomLog "logs/dummy-host.example.com-access.log" common
VirtualHost
VirtualHost _:80
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
##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
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
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" notifications@github.com<mailto:notifications@github.com> 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
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
VirtualHost
api.example.comhttp://api.example.com
VirtualHost :80
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
VirtualHost
example.comhttp://example.com
VirtualHost :80
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
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/Wildhoney/Magento-on-Angular/issues/74#issuecomment-41496081.
@ robbietapping it's mister Wildhoney his project :) and I try to learn from him.
But thanks for the thanks anyway :+1: :)
I never tried IIS, I'm happy for now starting to understand apache
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
try going to api.example.com/products -- what do you see?
Also, what do you see in your apache error log?
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:
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 notifications@github.com 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.
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 duringnpm install
:Managed to workaround this by changing the
dependencies
list inpackage.json
to:then tried to Initialise the Node.js instance: node node/server.js; but encountered the following error:
Any ideas what I'm doing wrong?