odoe / AGSModularDemo

Demo application using ArcGIS JavaScript API 3.2 with custom widgets
2 stars 0 forks source link

Getting build errors while trying to build using r.js #1

Open metangale opened 11 years ago

metangale commented 11 years ago

Hi,

I downloaded AGSModularDemo and tried building it without any modification but I am getting some errors, can you give me some directions.

Environment: Windows 8 installed node with npm

here are the steps I tried to install requirejs using npm and generating the build: -----------------------------Command Prompt log----------------------------------------------------------------------- Microsoft Windows Version 6.2.9200 2012 Microsoft Corporation. All rights reserved.

C:\Users\Ultimate>cd\

C:>npm

Usage: npm

where is one of: add-user, adduser, apihelp, author, bin, bugs, c, cache, completion, config, ddp, dedupe, deprecate, docs, edit, explore, faq, find, find-dupes, get, help, help-search, home, i, info, init, install, isntall, la, link, list, ll, ln, login, ls, outdated, owner, pack, prefix, prune, publish, r, rb, rebuild, remove, restart, rm, root, run-script, s, se, search, set, show, shrinkwrap, star, start, stop, submodule, tag, test, tst, un, uninstall, unlink, unpublish, unstar, up, update, version, view, whoami

npm -h quick help on npm -l display full usage info npm faq commonly asked questions npm help search for help on npm help npm involved overview

Specify configs in the ini-formatted file: C:\Users\Ultimate.npmrc or on the command line via: npm --key value Config info can be viewed via: npm help config

npm@1.1.69 C:\Program Files\nodejs\node_modules\npm

C:>npm install -g requirejs npm http GET https://registry.npmjs.org/requirejs npm http 200 https://registry.npmjs.org/requirejs npm http GET https://registry.npmjs.org/requirejs/-/requirejs-2.1.2.tgz npm http 200 https://registry.npmjs.org/requirejs/-/requirejs-2.1.2.tgz C:\Users\Ultimate\AppData\Roaming\npm\r.js -> C:\Users\Ultimate\AppData\Roaming\ npm\node_modules\requirejs\bin\r.js requirejs@2.1.2 C:\Users\Ultimate\AppData\Roaming\npm\node_modules\requirejs

C:>node C:\Users\Ultimate\AppData\Roaming\npm\node_modules\requirejs\bin\r.js - o C:\Users\Ultimate\Downloads\AGSModularDemo-master\app\src\js\app.build.js Error: Missing either a "name", "include" or "modules" option at Function.build.createConfig (C:\Users\Ultimate\AppData\Roaming\npm\node_m odules\requirejs\bin\r.js:22690:19)

C:>

odoe commented 11 years ago

Sorry it took me a while to get back to you. Once npm and requirejs are installed, you shouldn't need to use node to call the r.js module. Navigate to the directory of the application and use the following command r.js -o src/js/app.build.js

That should work.

Thanks.

On Mon, Dec 17, 2012 at 11:29 PM, metangale notifications@github.comwrote:

Hi,

I downloaded AGSModularDemo and tried building it without any modification but I am getting some errors.

Environment: Windows 8 installed node with npm

here are the steps I tried to install requirejs using npm and generating the build: -----------------------------Command Prompt log----------------------------------------------------------------------- Microsoft Windows Version 6.2.9200 http://c 2012 Microsoft Corporation. All rights reserved.

C:\Users\Ultimate>cd\

C:>npm

Usage: npm

where is one of: add-user, adduser, apihelp, author, bin, bugs, c, cache, completion, config, ddp, dedupe, deprecate, docs, edit, explore, faq, find, find-dupes, get, help, help-search, home, i, info, init, install, isntall, la, link, list, ll, ln, login, ls, outdated, owner, pack, prefix, prune, publish, r, rb, rebuild, remove, restart, rm, root, run-script, s, se, search, set, show, shrinkwrap, star, start, stop, submodule, tag, test, tst, un, uninstall, unlink, unpublish, unstar, up, update, version, view, whoami

npm -h quick help on npm -l display full usage info npm faq commonly asked questions npm help search for help on npm help npm involved overview

Specify configs in the ini-formatted file: C:\Users\Ultimate.npmrc or on the command line via: npm --key value Config info can be viewed via: npm help config

npm@1.1.69 C:\Program Files\nodejs\node_modules\npm

C:>npm install -g requirejs npm http GET https://registry.npmjs.org/requirejs npm http 200 https://registry.npmjs.org/requirejs npm http GET https://registry.npmjs.org/requirejs/-/requirejs-2.1.2.tgz npm http 200 https://registry.npmjs.org/requirejs/-/requirejs-2.1.2.tgz C:\Users\Ultimate\AppData\Roaming\npm\r.js -> C:\Users\Ultimate\AppData\Roaming\ npm\node_modules\requirejs\bin\r.js requirejs@2.1.2C:\Users\Ultimate\AppData\Roaming\npm\node_modules\requirejs

C:>node C:\Users\Ultimate\AppData\Roaming\npm\node_modules\requirejs\bin\r.js - o C:\Users\Ultimate\Downloads\AGSModularDemo-master\app\src\js\app.build.js Error: Missing either a "name", "include" or "modules" option at Function.build.createConfig (C:\Users\Ultimate\AppData\Roaming\npm\node_m odules\requirejs\bin\r.js:22690:19)

C:>

— Reply to this email directly or view it on GitHubhttps://github.com/odoe/AGSModularDemo/issues/1.

metangale commented 11 years ago

I tried using the command but it does not work. I also tried following:

  1. Specify the absolute path of r.js as follows: C:\Users\rahulme\AppData\Roaming\npm\r.js -o D:\AGSModularDemo-master\app\src\js\app.build.js

I get following error: Error: Missing either a "name", "include" or "modules" option at Function.build.createConfig (C:\Users\Ultimate\AppData\Roaming\npm\node_m odules\requirejs\bin\r.js:22690:19)

  1. Tried these steps from Mac still the same issue.

Am I missing something. I am not modifying anything in the downloaded application.

Thanks, Rahul

metangale commented 11 years ago

Finally I was able to build your MapStyler Application using cygwin. However whenever I try build this application it only optimizes CSS and rest of the files are just copied as is in release directory. js files are not uglified. Do you know why?

nickarnold commented 11 years ago

I too am having a tough time building the application with the r.js command on Windows 7 x64. I'm about to try this on an Ubuntu instance and report back... Great job with the demo app, btw.

nickarnold commented 11 years ago

Flawless build on Ubuntu. Here's how I did it:

Install node and npm sudo aptitude install nodejs npm

Install requirejs npm install requirejs

Clone repo git clone git://github.com/odoe/AGSModularDemo.git

"Compile" App r.js src/js/app.build.js

...boom! It works. Thanks for making this project.

rymor commented 11 years ago

I wasn't able to get this to work either. I have node and requirejs installed, cloned the repo and get the following error:

r.js -o app/src/js/app.build.js 

Error: Missing either a "name", "include" or "modules" option
at Function.build.createConfig (/usr/local/lib/node_modules/requirejs/bin/r.js:23702:19)

I went into the build file and uncommented the modules section:

modules  : [
    {
        name: "main"
    }],

I tried to build again but I'm getting an error on the text templates now:

TypeError: Cannot read property 'normalize' of undefined
In module tree:
main
  app
    views/ViewManager
      widgets/legendtoc/LegendMenuWidget
        widgets/legendtoc/LegendMenuItem

at Object.<anonymous> (/usr/local/lib/node_modules/requirejs/bin/r.js:1168:35)

Any ideas what is going on? Been trying to troubleshoot this for awhile with no luck. I'm on os x with v 2.1.5 of r.js and requirejs. Any help is appreciated. Thanks!

odoe commented 11 years ago

Just did some testing and build seems to break with v 2.1.5 or r.js. Works fine with v1.0.8. I'll need to revisit this as I have been using other tools for deployment lately (.NET Web Optimization and node express with minification).

I'll try to get back to this soon and see if I can fix it. I'm considering changing my build process to just use Grunt with UglifyJS, as minification is the main goal. The ArcGIS JS API doesn't lend itself very well to single file builds without a little leg work.

The AGRC guys have done a lot of the leg work to use the Dojo build system for the projects. https://github.com/agrc/AGRCJavaScriptProjectBoilerPlate

rymor commented 11 years ago

Thanks for the reply. I had a feeling it had to do with an updated version of r.js. I have looked at the stuff the AGRC guys were doing, but was having some problems with that as well. The dojo build system seems a bit daunting, r.js seems much more simple to get up and going.

I will probably try and reach out to the AGRC maintainers to see if they can offer any help. Thanks again for testing the versions.