Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs + npm, installing modules on ntfs partition

I have a problem when installing npm modules. NodeJS is installed on Ubuntu 11.10 running on Virtual Box on Windows host. My project files are on NTFS partition (I have to share them with windows). When I try to install some npm module I get an error, and module is not installed. I've found out that problem occurs when npm tries to create symbolic links.

Probably you can not create symlinks on NTFS partition, when I'm installing module "inside" Linux file system, everything works fine.

How can I fix this? I don't want to resolve dependencies manually :/

like image 754
Sosnowski Avatar asked Nov 22 '11 19:11

Sosnowski


People also ask

Where should I install node modules?

On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally. If you set the NODE_PATH environment variable to this path, the modules can be found by node.

Does npm install automatically install dependencies?

The 'npm install' command should add all the dependencies and devDependencies automatically during installation. If you need to add specific devDependencies to your project, you can use this command- 'npm install --save-dev'. This will add your desired npm library to the package. json file.


2 Answers

Since version 1.2.21, npm has a new option for the install command. --no-bin-links

You can use if for installing a specific node module

npm install express --no-bin-links 

and also for a package.json install

npm install --no-bin-links 

With this option I've been able to install many npm modules without problems in my shared forlder inside the VM (Ubuntu guest, Windows Host)

The commit where the option was added to the npm code is b4c58617039c21c10889a9869f8e86a23e17d3a0

like image 185
blackjid Avatar answered Oct 07 '22 02:10

blackjid


Try this - http://ahtik.com/blog/2012/08/16/fixing-your-virtualbox-shared-folder-symlink-error/

Works for me!

Basically you set a parameter

VBoxManage setextradata YOURVMNAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/YOURSHAREFOLDERNAME 1

And then run the VM as an administrator....

like image 37
Mahbub Avatar answered Oct 07 '22 01:10

Mahbub