Issues with WSL
After installing autorest on WSL (Windows Subsystem for Linux), I'm getting the following error message when trying to run basic commands:
$autorest --help AutoRest code generation utility [version: 2.0.4283; node: v8.12.0] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Failure: Error: Unable to resolve package '@microsoft.azure/autorest-core@^2.0.4283'. Error: Unable to resolve package '@microsoft.azure/autorest-core@^2.0.4283'. at fetch (/node_modules/@microsoft.azure/extension/dist/main.js:295:26) at /node_modules/npm/node_modules/call-limit/call-limit.js:22:12 at _combinedTickCallback (internal/process/next_tick.js:132:7) at process._tickCallback (internal/process/next_tick.js:181:9)
o_O
I use autorest under wsl quite a bit, and it works here.
Hmm. Gonna need a bit more data I think.
- How did you install nodejs ? (apt-get or nvs or nvm)
- how did you install autorest ( npm -g autorest )
- what happens when you run
autorest --reset - what happens when you run
autorest --info
@fearthecowboy, some comments below.
How did you install nodejs ? (apt-get or nvs or nvm) --> Very likely apt-get. Just in case you need Node version is v8.12.0, npm version is 6.4.1
how did you install autorest ( npm -g autorest ) --> Yes, I used npm -g (sudo npm install -g autorest)
what happens when you run autorest --reset
#autorest --reset AutoRest code generation utility [version: 2.0.4283; node: v8.12.0] (C) 2018 Microsoft Corporation. https://aka.ms/autorest Failure: Error: Unable to resolve package '@microsoft.azure/autorest-core@^2.0.4283'. Error: Unable to resolve package '@microsoft.azure/autorest-core@^2.0.4283'. at fetch (/node_modules/@microsoft.azure/extension/dist/main.js:295:26) at /node_modules/npm/node_modules/call-limit/call-limit.js:22:12 at _combinedTickCallback (internal/process/next_tick.js:132:7) at process._tickCallback (internal/process/next_tick.js:181:9)
what happens when you run autorest --info
#autorest --info AutoRest code generation utility [version: 2.0.4283; node: v8.12.0] (C) 2018 Microsoft Corporation. https://aka.ms/autorest
Showing All Installed Extensions
No Extensions are currently installed.
I've had some very strange behaviors with node when it's installed via apt-get.
The worst part is that it requires root to install it that way.
If it's possible, can you remove that version of node and npm, and then try using nvs:
from a standard user prompt:
# install node-version-switcher
export NVS_HOME="$HOME/.nvs"
git clone https://github.com/jasongin/nvs "$NVS_HOME"
. "$NVS_HOME/nvs.sh" install
# then install the latest LTS version
nvs add lts
# set as the default
nvs use lts
# To add it to PATH permanently,
nvs link lts
Then, install autorest
# install the npm globally (no elevation)
npm install -g autorest
# (precautionary) reset the plugins.
autorest --reset
# install a generator
autorest --nodejs --help
After removing node and npm and installing them using the instructions above, the error message disappeared and autorest appears to be working.
Tks!
sigh.
It shouldn't have to be that way -- npm should work the same regardless if you're root/elevated or not, yet it doesn't.
I gotta get my programatic dependency management ported to yarn .. Perhaps that'd get rid of the pain.