Nodeenv - npm does not install in virtualenv

I have installed virtual virtual python using virtualenvwrapper. Once configured, it seems that the node programs still work with global installations instead of using virtualenv versions.

Steps:

  • Create a virtualenv named "env"

    mkvirtualenv env
    
          

  • Activate virtualenv

    workon env
    
          

  • Install nodeenv

    pip install nodeenv
    
          

  • Install node.js and add nodeenv wrapper functions to virtualenv

    nodeenv -p
    
          

  • Deactivate and reactivate virtualenv (with ... env / bin / source activate)

  • Check node.js path (gives correct path inside virtualenv)

    which node
    
          

  • Install material

    npm install -g yo grunt-cli bower
    
          

  • Testing paths (shows my global path: /home/USER/.node/bin/grunt)

    which grunt
    
          

The "node_modules" directory is created in the directory where I run the npm install command, but as I mentioned earlier, when I check the working path for each node program, it is the global path, not inside virtualenv like node.js. This also causes problems, for example Yeoman complains when it states that "[error] npm root value is missing in your NODE_PATH" and then although it says that it has successfully installed the generator, the generator does not appear in the list (this is still inside virtualenv).

Outside virtualenv I can use node.js programs ok.

This thread seems similar but didn't help me: nodeenv - not linking grunt when installed via npm install -g?

Any help would be greatly appreciated!

+3


source to share





All Articles