Johnny-five error

User avatar
Posts: 55
Joined: Mon Mar 11, 2013 1:55 am

Johnny-five error

Unread postby Denis » Mon Mar 11, 2013 2:05 am

I have not had any luck with Node and Johnny-five. Apparently the path is not going to all the modules which are needed.
This is an example of the error I get.

denis@denis-HP-Compaq-nx7400-EN352UT-ABA:/node_modules$ node johnny-five.js

module.js:340
throw err;
^
Error: Cannot find module '/node_modules/johnny-five.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Denis

User avatar
Posts: 129
Joined: Mon Feb 04, 2013 6:40 pm
Location: Orono

Re: Johnny-five error

Unread postby Derrick » Mon Mar 11, 2013 2:33 pm

What path is johnny-five in?
It looks like it's searching from the root: '/node_modules/johnny-five.js'

You may need to do this:
Code: Select all
export NODE_PATH=/usr/local/lib/node_modules

or if they are in your Home:
Code: Select all
export NODE_PATH=~/.npm
-=Derrick=-

User avatar
Posts: 55
Joined: Mon Mar 11, 2013 1:55 am

Re: Johnny-five error

Unread postby Denis » Tue Mar 12, 2013 4:18 pm

Derrick,
If I go to the folder with the .js file then it will run unless it calls a module from another folder. It can't find the path to the module.

We can figure it out on Wednesday.

Thanks,

Denis

User avatar
Posts: 55
Joined: Mon Mar 11, 2013 1:55 am

SOLVED: Johnny-five error

Unread postby Denis » Fri Mar 15, 2013 11:16 am

Derrick solved the problem for me.
There are many folders called /node_modules. All the folders in these folders should be in the same /node_modules. After we moved them to the one folder things started working.

User avatar
Posts: 190
Joined: Tue Feb 05, 2013 11:48 pm
Location: Bangor, ME

Re: Johnny-five error

Unread postby garrettwilkin » Mon Apr 01, 2013 4:28 pm

Just in case you are still wondering about this.

NPM is the node package manager. You install packages for in each project folder, like this:

npm install johnny-five

NPM will then download and install the johnny-five package into just that local project folder. Every time that you need to work on another project and use the johnny-five module, you have to install it in that folder too.

In some cases, it makes sense to install a module globally. NPM will do that for you if you type:

npm install -g johnny-five

Then you will have one globally installed johnny-five module that's available for any project that you're working on.

Return to Node.js

Who is online

Users browsing this forum: No registered users and 1 guest