0

I'm trying to use nodeenv but it doesn't seem like binaries are getting linked for npm installed modules.

$ mkvirtualenv venv
(venv)$ pip install nodeenv
(venv)$ nodeenv -p
(venv)$ deactivate
$ workon venv
(venv)$ which grunt
/usr/local/bin/grunt
(venv)$ npm install -g grunt
...
(venv)$ which grunt
/usr/local/bin/grunt
(venv)$ cd $WORKON_HOME/venv
(venv)$ ls bin
activate         activate.fish    easy_install     get_env_details  nodeenv          pip              postactivate     preactivate      python
activate.csh     activate_this.py easy_install-2.7 node             npm              pip-2.7          postdeactivate   predeactivate
### no grunt exe!
(venv)$ ls lib/node_modules
fsevents          grunt             mean              npm               recursive-readdir
### but it's in node_modules!

Am I doing something wrong?

ashgromnies
  • 3,266
  • 4
  • 27
  • 43
  • Strangely this seems to work better when I install packages with `npm install --save-dev` rather than `npm install -g`. Any explanation why? Is that what should be done when using nodeenv? All the examples show `npm install -g` – ashgromnies Mar 09 '14 at 18:13
  • What versions of python/nodeenv/node do you use? https://github.com/ekalinin/nodeenv/issues/51 – shorrty Mar 20 '14 at 11:14

1 Answers1

0

You need to deactivate your venv and activate it then with source bin/activate

There are some node related environment changes. I found it trying integrate nodeenv in my jenkins build process.

The other way is to make required environment by hands. For example Jenkins Shiningpanda don't allow to deactivate virtualenv (or I don't know how), so I used this workaround

pip install nodeenv
nodeenv --python-virtualenv

export NODE_VIRTUAL_ENV=$VIRTUAL_ENV
export PATH=$NODE_VIRTUAL_ENV/bin:$PATH
export NODE_PATH=$NODE_VIRTUAL_ENV/lib/node_modules
export NPM_CONFIG_PREFIX=$NODE_VIRTUAL_ENV

npm install -g bower
bower