strongloop / loopback-example-offline-sync

Offline sync, change tracking, and replication.
http://loopback.io/doc/en/lb2/Synchronization.html
Other
286 stars 110 forks source link

[windows] gulp error: Cannot find module 'local.config' #25

Closed lukasmerta closed 10 years ago

lukasmerta commented 10 years ago

Hi, when starting from scratch (by manual), I get 2 errors - in step "npm install" I get this error:

npm ERR! peerinvalid The package loopback-datasource-juggler does not satisfy its siblings' peerDepe ndencies requirements! npm ERR! peerinvalid Peer loopback@2.0.0-beta3 wants loopback-datasource-juggler@2.0.0-beta1 npm ERR! peerinvalid Peer loopback-connector-mongodb@1.2.6 wants loopback-datasource-juggler@1.x.x

npm ERR! System Windows_NT 6.1.7601 npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\n pm\bin\npm-cli.js" "install" npm ERR! cwd d:\projects\loopback-example-full-stack npm ERR! node -v v0.10.26 npm ERR! npm -v 1.4.3 npm ERR! code EPEERINVALID npm ERR! npm ERR! Additional logging details can be found in: npm ERR! d:\projects\loopback-example-full-stack\npm-debug.log npm ERR! not ok code 0

and when building the app using "gulp" command, I get another error:

module.js:340 throw err; ^ Error: Cannot find module 'local.config' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object. (d:\projects\loopback-example-full-stack\web\app.js:6:20) 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) at Function.Module.runMain (module.js:497:10)

What should I set, please? Thank you Lukas

bajtos commented 10 years ago

Hi Lukas, thank you for reporting the issue.

npm ERR! peerinvalid Peer loopback-connector-mongodb@1.2.6 wants loopback-datasource-juggler@1.x.x

As mentioned in another issue, the mongodb connector is not compatible with 2.x juggler yet. (Well, it works with 2.x, but the package.json was not updated yet - see strongloop/loopback-connector-mongodb#34.)

Temporary workaround:

remove loopback-connector-mongodb from package.json dependencies
rm -rf node_modules/loopback-connector-mongodb
npm install

The example uses memory connector by default, so it should work fine in dev environment

when building the app using "gulp" command, I get another error

Once you fixed the npm dependencies, run the gulp command again and post the full output here please.

lukasmerta commented 10 years ago

thank you for your reply, I have done all steps from scratch

npm install
rm -rf node_modules/loopback-connector-mongodb
npm install

and I am still getting an error

d:\projects\loopback-example-full-stack\node_modules\loopback-connector-mongodb\node_modules\mongodb\node_modules\bson>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modul
es\node-gyp\bin\node-gyp.js" rebuild
npm ERR! peerinvalid The package loopback-datasource-juggler does not satisfy its siblings' peerDepe
ndencies requirements!
npm ERR! peerinvalid Peer loopback@2.0.0-beta3 wants loopback-datasource-juggler@2.0.0-beta1
npm ERR! peerinvalid Peer loopback-connector-mongodb@1.2.6 wants loopback-datasource-juggler@1.x.x

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd d:\projects\loopback-example-full-stack
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     d:\projects\loopback-example-full-stack\npm-debug.log
npm ERR! not ok code 0

I have temporary fixed it changing the dependency to "correct" version in node_modules\loopback-connector-mongodb\package.json file

  "peerDependencies": {
    "loopback-datasource-juggler": "2.0.0-beta1"
  },
  "devDependencies": {
    "loopback-datasource-juggler": "2.0.0-beta1", 
...

(hopefully this has no impact to build/run)

npm install now finished correctly, but there is still an error runnin gulp

d:\projects\loopback-example-full-stack>gulp
[11:37:22] Warning: gulp version mismatch:
[11:37:22] Running gulp is 3.7.0
[11:37:22] Local gulp (installed in gulpfile dir) is 3.6.2
[11:37:22] Using gulpfile d:\projects\loopback-example-full-stack\gulpfile.js
[11:37:22] Starting 'build'...
[11:37:27] Finished 'build' after 4.21 s
[11:37:27] Starting 'run'...
[gulp] [nodemon] v1.0.20
[gulp] [nodemon] to restart at any time, enter `rs`
[gulp] [nodemon] watching: d:\projects\loopback-example-full-stack/**/*
[gulp] [nodemon] starting `node --debug web/app.js`
debugger listening on port 5858

module.js:340
    throw err;
    ^
Error: Cannot find module 'local.config'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (d:\projects\loopback-example-full-stack\web\app.js:6:20)
    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)
    at Function.Module.runMain (module.js:497:10)
[11:37:32] Finished 'run' after 5.3 s
[11:37:32] Starting 'default'...
[11:37:32] Finished 'default' after 21 us
[gulp] [nodemon] app crashed - waiting for file changes before starting...
bajtos commented 10 years ago

I have temporary fixed it changing the dependency to "correct" version in node_modules\loopback-connector-mongodb\package.json file (hopefully this has no impact to build/run)

That's fine.

there is still an error runnin gulp

I am able to reproduce the problem on Windows. Do you have access to a Linux box, e.g. in a virtual machine like VirtualBox or Microsoft's Hyper-V?

Most likely we will be moving away from gulp soon, thus fixing the build on windows is not a high priority now.

lukasmerta commented 10 years ago

I have no access to any linux powered machine (and it would be overhead to install one to run one example application :-) ) Then ok, no problem, I will wait till you leave gulp.. (do you have any rough estimate?) is there any simple workaround for me to run the example? Like place "local.config" file to some location? Is so, please publish that file and write me where to place it or publish built version. Unfortunately the new synchronization feature was one of the most interesting to start using loopback :-) Do you plan also something like realtime synchronization (similar what Firebase or Meteor does)?

bajtos commented 10 years ago

Here are the files produced by build:

./api/node_modules/local.config.js
module.exports = process.LOCAL_CONFIG = {}

./html5/node_modules/local.config.js
module.exports = process.LOCAL_CONFIG = {"serverInfo":{"api":{"protocol":"http","port":3000,"host":"localhost","root":"/api"},"url":"http://localhost:3000/api"},"routes":{"/":{"controller":"HomeCtrl","templateUrl":"/views/welcome.html"},"/me":{"controller":"UserCtrl","templateUrl":"/views/me.html"},"/my/todos/:status":{"controller":"TodoCtrl","templateUrl":"/views/todos.html"},"/my/todos":{"controller":"TodoCtrl","templateUrl":"/views/todos.html"},"/login":{"controller":"LoginCtrl","templateUrl":"/views/login.html"},"/register":{"controller":"RegisterCtrl","templateUrl":"/views/register.html"},"/debug":{"controller":"ChangeCtrl","templateUrl":"/views/changes.html"}}}

./web/node_modules/local.config.js
module.exports = process.LOCAL_CONFIG = {"port":3000,"host":"localhost","title":"Todo App (development)","homeTemplate":"home.ejs","appTemplate":"app.ejs","staticCSS":"/Users/bajtos/src/loopback/example-full-stack/web/css"}

Make sure to change the staticCSS path in web/node_modules/local.config.js to match the location on your computer.

I will wait till you leave gulp.. (do you have any rough estimate?)

I things go well then it should be done by the end of the next week.

Do you plan also something like realtime synchronization (similar what Firebase or Meteor does)?

I don't think we will have bandwidth for this in the next few months, there is still a lot of work needed to polish the current non-realtime synchronisation.

lukasmerta commented 10 years ago

There is another error, but if it is about weeks, I will go back to this example after you migrate the building system.. Thank you for support

jboothe commented 10 years ago

@bajtos why are you moving away from Gulp which has allowed devs to regain their sanity?!?

bajtos commented 10 years ago

@jboothe Two reasons:

  1. The project structure and configuration should be agnostic of build tools. Developers should be able to use their favourite tool, be it Grunt, Gulp, or something else.
  2. Yo generators like yo angular and yo backbone use Grunt. We don't want to reinvent wheel (yet) by writing our own generators for the front-end SPA. In order to use the existing generators, we have to switch to Grunt in this example project.
bajtos commented 10 years ago

The refactoring of the project structure is done, Gulp and */node_modules/local.config.js are no longer used.

@lukasmerta Could you please check the current version and let me know if there are any issues?

lukasmerta commented 10 years ago

Yes, the build succeeds now, thanks There is probably another issus with angular - in Firefox 30 (on windows) the page /my/todos does not expand the {{variables}}, Chrome works fine

bajtos commented 10 years ago

There is probably another issus with angular - in Firefox 30 (on windows) the page /my/todos does not expand the {{variables}}, Chrome works fine

I am able to reproduce the problem in Firefox too, it's a loopback issue - see strongloop/loopback#355.

Yes, the build succeeds now, thanks

Cool, I am closing this issue as resolved.