Nodeenv - not linking grunt when installing via npm install -g?

I'm trying to use nodeenv, but it doesn't seem like the binaries are associated with the installed npm 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 in node_modules!

      

Am I doing something wrong?

0


source to share


1 answer


You need to deactivate your venv and activate it with the original bin / activate

There are several related changes to the node environment. I found it trying to integrate nodeenv into my jenkins build process.



Another way is to create the necessary environment by hand. For example Jenkins Shiningpanda does not allow you 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

      

0


source







All Articles