First, create the global link by returning to the colors folder and using the link command:
cd ../colors
sudo npm link
Once complete, your shell will output:
/usr/local/lib/node_modules/colors -> /home/sammy/colors
You just created a symlink in your node_modules folder to your colors directory.
Return to the really-large-application folder and link the package:
cd ../really-large-application
sudo npm link colors
You will receive output similar to the following:
/home/sammy/really-large-application/node_modules/colors -> /usr/local/lib/node_modules/colors -> /home/sammy/colors
As the output shows, you just created a symlink from your really-large-application
’s local node_modules directory to the colors
symlink in your global node_modules
, which points to the actual directory with the colors module.
The linking process is complete. Run your file to ensure it still works: