liferay / liferay-theme-tasks

A set of tasks for building and deploying Liferay Portal themes.
18 stars 24 forks source link

No globally installed themelet found #27

Closed caneta closed 8 years ago

caneta commented 8 years ago

Hi everyone. I've tried to follow this guide to create a themelet. Everything seems fine, npm link command included:

user@host:/home/test/liferayworkspace/themelets/test-themelet$ ll ~/.nvm/versions/node/v6.2.1/lib/node_modules/
totale 24K
lrwxrwxrwx  1 user users   87 giu  8 15:33 test-themelet -> /home/test/liferayworkspace/themelets/test-themelet

The problem is that when I try to install it inside my theme, I get the following:

user@host:$ gulp extend
[15:28:02] Using gulpfile /home/test/liferayworkspace/themes/test-theme/gulpfile.js
[15:28:02] Starting 'extend'...
? What kind of theme asset would you like to extend? Themelet
? Where would you like to search for themelets? Search globally installed npm modules (development purposes only)
[15:28:04] No globally installed themelet found. Install some with "npm i -g [name]"

Why my themelet is not found? I'm using node-6.2.1 installed through nvm on an Linux Xubuntu machine 64 bit. I've also opened a thread on Liferay forum.

natecavanaugh commented 8 years ago

Hi Alessandro, The reason for this is because of the absence of a NODE_PATH environment variable. We use this to determine where to search a user's node modules. We have some ideas on how to improve this to make it easier for us to find, as well as to alert users as to why no themes were found.

In order to set it, go ahead and add the following line to your .bashrc or .bash_profile (or your .zshrc if you use zsh):

export NODE_PATH="$NODE_PATH:$HOME/.nvm/versions/node/v6.2.1/lib/node_modules/"

Keep in mind, since you're using nvm, you'll need to change this if/when you change or upgrade your version of node.

Thanks for letting us know about this issue :)

robframpton commented 8 years ago

Hey @caneta

We've also published v1.3.1 which has some minor improvements in locating globally installed themes/themelets. So if you reinstall your theme's node_modules and try the extend again there is a chance it will now work with your current environment.

caneta commented 8 years ago

@Robert-Frampton, I've tryed with v1.3.1, but my NODE_PATH remains empty. Instead, setting the environment variable inside my .bashrc, as suggested by @natecavanaugh, did the trick:

user@host:$ node -e "console.log(process.env.NODE_PATH)"
:/home/user/.nvm/versions/node/v6.2.1/lib/node_modules/

After that I was able to install themelets as Liferay Developer Network describes.

Thank you so much guys!