2

I'm trying to create a virtualenv in a node.js project to manage nodejs dependancies like grunt, bower, etc.

Trying to use nodeenv for that.

But its not getting recognized. I did both npm install nodeenv and with -g flag as well. The dependancy is installed in my node_modules as well, still getting this error.

2
  • What are you trying to achive? Just to create a file from which you can load environment variables? Commented Sep 13, 2018 at 7:25
  • An environment from where I can load build dependancies like bower, grunt Commented Sep 13, 2018 at 14:22

2 Answers 2

1

Had to install python in my system, and then pip install nodeenv to make it work(for windows).

Linux users can directly sudo apt-get install nodeenv to get nodeenv and start working with it.

Sign up to request clarification or add additional context in comments.

Comments

0
➜  ~ npm install nodeenv -g
+ [email protected]
added 1 package in 2.519s

╭─────────────────────────────────────╮
│                                     │ 
│   Update available 5.6.0 → 6.4.1    │
│       Run npm i npm to update       │
│                                     │
╰─────────────────────────────────────╯

➜  ~ nodeenv   myenv   
 * Install prebuilt node (10.10.0) ..... done.

after this you need to activate node virtualenv

➜  ~ source myenv/bin/activate
(myenv) ➜  ~

now you install all your node modules.

remember to activate your virtualnev whenever you need to use those modules.

you can deactivate your virtualenv with below command

(myenv) ➜  ~ deactivate_node
➜  ~

1 Comment

Yeah the flow explained here is correct, but the problem was that nodeenv wasn't getting recognised by the system after npm install

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.