How to get the "dnu" command working on OS X?

.NetMacosasp.net CoreDnx

.Net Problem Overview


Just downloaded and installed Visual Studio Code on OS X 10.10.3.

I've managed to partially follow the installation instructions for ASP.NET 5.

What I fail with is when the instruction tells me to call

dnu restore

When doing this in my terminal, it says:

> -bash: dnu: command not found

I've found a somewhat similar question here on SO which unfortunately did not help me.

My question:

How can I make the "dnu" command work on OS X?

Update:

Someone marked my questions as the duplicate of the SO question I linked to by myself.

Now SO forces me to edit my question to proof that it is not a duplicate. So basically that is me right now:

I have no idea what I'm doing

I hope this satisfies the needs of SO to not close my question as a duplicate since my understanding is that it is no duplicate.

.Net Solutions


Solution 1 - .Net

To answer my own question:

What helped, was Jed Grant's comment and link to this GitHub discussion.

I did the following in a terminal:

source dnvm.sh
dnvm upgrade -u

And suddenly the "dnu" command was available so that I could run

dnu restore

As the installation instructions told me.

Solution 2 - .Net

Bit of a noob answer, but it might help someone. If you're on OS X, make sure you follow the instructions carefully! I completely missed some OS X specific instructions under the heading "Installing ASP.NET 5 and DNX". I read the heading and thought "I've already installed this".

The instructions for OS X points to:

https://github.com/aspnet/home#os-x

It says to run the following homebrew commands:

brew tap aspnet/dnx
brew update
brew install dnvm

After this succeeds, the following text is output in the console:

> Add the following to the ~/.bash_profile, ~/.bashrc or ~/.zshrc file: > > source dnvm.sh

I added it to my .bash_profile and now dnu restore works from my project directory!

In general, I found the steps on the ASP.NET 5 docs page much clearer than the Visual Studio Code page. Acronyms are explained and screenshots of many steps are present.

Installing ASP.NET 5 on Mac OS X

Your First ASP.NET 5 Application on a Mac

Solution 3 - .Net

For those trying to get this working on windows with the same problem, you just need to run dnvm upgrade from command prompt. dnu will now work.

Solution 4 - .Net

After read this issue in GitHub:

GitHub Issue

Run nano ~/.bash_profile

Add:

export PATH="~/npm-global/bin:$PATH" 
source dnvm.sh

Edit: It not solve the problem at all... when I try to update the Nuget Packages using dnvm command (is the purpose of dnx restore), I have other error:

> Error: Could not find latest version from feed > https://nuget.org/api/v2

Solution 5 - .Net

Steps to get dnu command working.

Open Visual Studio Command prompt and run following commands:

  1. check list of available DNVM using command dnvm list
  2. dnvm use 1.0.0-rc1-update1 (change based on your requirement)
  3. dnu restore

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionUwe KeimView Question on Stackoverflow
Solution 1 - .NetUwe KeimView Answer on Stackoverflow
Solution 2 - .NetDavid SpenceView Answer on Stackoverflow
Solution 3 - .NetkspearrinView Answer on Stackoverflow
Solution 4 - .NetchemitaxisView Answer on Stackoverflow
Solution 5 - .NetDhanik Lal SahniView Answer on Stackoverflow