Community
cancel
Showing results for 
Search instead for 
Did you mean: 
DDang1
Beginner
1,296 Views

How to install ExpressJS and other libraries (for node.js)

Jump to solution

Hi guys,

My board is already run opkg update.

I have a problem with installing ExpressJS. First, I have some nodejs code that use Express module. So I installed the library on by system:

root@edison:~# npm install express

The installation seem to be good with no error. But when I run my project:

root@edison:/media/sdcard/SocketIO-001# node main.js (my project folder is located on the sdcard)

There is an error: Cannot find module 'express'

I think the problem is that I installed the module in the wrong place, so I change the directory to "/media/sdcard/SocketIO-001" and reinstall the module. But this time, there is a problem:

root@edison:/media/sdcard/SocketIO-001# npm install express --save

 

npm ERR! Linux 3.10.98-poky-edison+

 

npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "express" "--save"

 

npm ERR! node v4.4.3npm ERR! npm v2.15.1npm ERR! path ../mime/cli.js

 

npm ERR! code EPERMnpm ERR! errno -1npm ERR! syscall symlink

 

npm ERR! Error: EPERM: operation not permitted, symlink '../mime/cli.js' -> '/media/sdcard/SocketIO-001/node_modules/express/node_modules/send/node_modules/.bin/mime'

 

npm ERR! at Error (native)

 

npm ERR! { [Error: EPERM: operation not permitted, symlink '../mime/cli.js' -> '/media/sdcard/SocketIO-001/node_modules/express/node_modules/send/node_modules/.bin/mime']

 

npm ERR! errno: -1,

 

npm ERR! code: 'EPERM',

 

npm ERR! syscall: 'symlink',

npm ERR! path: '../mime/cli.js',

 

npm ERR! dest: '/media/sdcard/SocketIO-001/node_modules/express/node_modules/send/node_modules/.bin/mime' }

 

npm ERR!

 

npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:

 

npm ERR! /media/sdcard/SocketIO-001/npm-debug.log

I got stuck now. Please help me. Thanks alot!

0 Kudos
1 Solution
idata
Community Manager
75 Views

Hi NewMech,

 

 

I would love to help you with your issue.

 

 

I think that you should run the command using the save flag:

 

 

npm install express --save

 

 

If you don't use this flag you will install you won't add it to the dependencies.

 

 

Personally, I recommend you to copy your code to the Edison and install express and run the code in the same directory, not in the SDcard.

 

 

You can also check this guide for a similar example: https://medium.com/@monkeytypewritr/control-your-intel-edison-in-realtime-with-websockets-f16e49b2b2... .pmk0001cf

 

 

I hope you find this helpful.

 

 

Regards,

 

-Leonardo

View solution in original post

3 Replies
idata
Community Manager
76 Views

Hi NewMech,

 

 

I would love to help you with your issue.

 

 

I think that you should run the command using the save flag:

 

 

npm install express --save

 

 

If you don't use this flag you will install you won't add it to the dependencies.

 

 

Personally, I recommend you to copy your code to the Edison and install express and run the code in the same directory, not in the SDcard.

 

 

You can also check this guide for a similar example: https://medium.com/@monkeytypewritr/control-your-intel-edison-in-realtime-with-websockets-f16e49b2b2... .pmk0001cf

 

 

I hope you find this helpful.

 

 

Regards,

 

-Leonardo

View solution in original post

DDang1
Beginner
75 Views

Ok, the problem is now solved, But I still put my code in the sd card. It run perfectly. It's so strange that the "node_module" directory is not on the SDcard but the code still work!

Instead of using --save flag, I use: sudo npm install express --g.

idata
Community Manager
75 Views

Hi NewMech,

 

 

That's great. Thank you for letting us know.

 

 

Feel free to contact us when you have issues.

 

 

Regards,

 

-Leonardo
Reply