Cannot find module "loopback"

2,473 views
Skip to first unread message

Sayan Bhattacharya

unread,
Jul 20, 2015, 5:00:51 PM7/20/15
to loopb...@googlegroups.com
I receive the following error when I run the command slc run

tinker@tinker:~/Desktop/loopback$ slc run
INFO strong-agent native addon missing, install a compiler
INFO strong-agent v1.6.3 profiling app 'tags-crud' pid '7323'
INFO strong-agent[7323] started profiling agent
INFO supervisor reporting metrics to `internal:`
supervisor running without clustering (unsupervised)
module.js:338
    throw err;
          ^
Error: Cannot find module 'loopback'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at Module.module.__proto__.require (/usr/local/lib/node_modules/strongloop/node_modules/strong-agent/lib/agent.js:248:42)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/tinker/Desktop/loopback/server/server.js:1:78)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

I get the above error only for slc run. All the other slc commands works just fine.

I had installed loopback with npm install -g strongloop

Rand McKinney

unread,
Jul 20, 2015, 7:34:30 PM7/20/15
to loopb...@googlegroups.com, bhattachar...@gmail.com
To use slc run without an argument, your working directory must be the root directory of your LoopBack app (containing the main script).  See the slc run command reference doc.  In this case your working directory is loopback, so its looking for an application with that name.  First, create an app with slc loopback, then cd to that directory and run it, as explained in Getting started with LoopBack.

And in general, instead of using slc run, you should either just run your app with node . or use slc start, as explained here: http://docs.strongloop.com/display/SLC/Running+apps+with+slc

Rand

Raymond Feng

unread,
Jul 20, 2015, 7:47:56 PM7/20/15
to loopb...@googlegroups.com, bhattachar...@gmail.com
Please make sure there is no error during `npm install -g strongloop`.

Thanks,

---
Raymond Feng
Co-Founder and Architect @ StrongLoop, Inc.

StrongLoop makes it easy to develop APIs in Node, plus get DevOps capabilities like monitoring, debugging and clustering.

On Jul 20, 2015, at 4:34 PM, Rand McKinney <ra...@strongloop.com> wrote:

To use slc run without an argument, your working directory must be the root directory of your LoopBack app (containing the main script).  See the slc run command reference doc.

However, instead of using slc run, you should either just run your app with node . or use slc start, as explained here: http://docs.strongloop.com/display/SLC/Running+apps+with+slc

-- 
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/5c83eb16-0218-4fe5-b911-52c6c9c361f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sayan Bhattacharya

unread,
Jul 20, 2015, 11:58:02 PM7/20/15
to loopb...@googlegroups.com
I am using MySQL as the datasource and I have a MySQL db setup already on my localhost. When I try to run node . I get the following error. I did install the MySQL connector but it seems not to be working. I installed the connector by running npm install loopback-connector-mysql --save from the project directory. Still no luck.

WARNING: LoopBack connector "mysql" is not installed as any of the following modules:

 ./connectors/mysql
loopback-connector-mysql

To fix, run:

    npm install loopback-connector-mysql

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error:
WARNING: LoopBack connector "mysql" is not installed as any of the following modules:

 ./connectors/mysql
loopback-connector-mysql

To fix, run:

    npm install loopback-connector-mysql

    at DataSource.setup (/home/tinker/node_modules/loopback-datasource-juggler/lib/datasource.js:304:28)
    at new DataSource (/home/tinker/node_modules/loopback-datasource-juggler/lib/datasource.js:109:8)
    at Registry.createDataSource (/home/tinker/node_modules/loopback/lib/registry.js:349:12)
    at dataSourcesFromConfig (/home/tinker/node_modules/loopback/lib/application.js:414:19)
    at EventEmitter.app.dataSource (/home/tinker/node_modules/loopback/lib/application.js:221:12)
    at /home/tinker/node_modules/loopback-boot/lib/executor.js:160:9
    at /home/tinker/node_modules/loopback-boot/lib/executor.js:251:5
    at Array.forEach (native)
    at forEachKeyedObject (/home/tinker/node_modules/loopback-boot/lib/executor.js:250:20)
    at setupDataSources (/home/tinker/node_modules/loopback-boot/lib/executor.js:159:3)
Reply all
Reply to author
Forward
0 new messages