dfinity / sdk

IC SDK: a Software Development Kit for creating and managing canister smart contracts on the ICP blockchain.

Home Page:https://internetcomputer.org/developers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Developer Experience] Attempting to spin up a local replica in a folder without a dfx.json gives a confusing error message

ByronBecker opened this issue · comments

% dfx start
Warning: The version of DFX used (0.12.1) is different than the version being run (0.13.1).
This might happen because your dfx.json specifies an older version, or DFX_VERSION is set in your environment.
We are forwarding the command line to the old version. To disable this warning, set the DFX_WARNING=-version_check environment variable.

Error when trying to forward to project dfx:
Failed to get path to binary 'dfx' for version '0.12.1'.

Caused by:
    0: Failed to install binary cache for version '0.12.1'.
    1: Unknown version '0.12.1'.
Installed executable: 0.13.1

I would expect to see a message like: This project does not have a dfx.json in its directory, and I was surprised to see the message show 0.12.1 (made me think I had something installed incorrectly).

Meta

dfx --version:

0.13.1

I cannot reproduce this behavior. Do you perhaps have DFX_VERSION set to 0.12.1?

Hi @adamspofford-dfinity 👋

I'm on a MacBook Pro 16" 2019.

As you can see in the commands below, DFX_VERSION is not set (logs an empy line).

Step 1: Navigate one level above your project directory (there is no dfx.json)
Step 2: Run dfx start

% dfx start
Warning: The version of DFX used (0.12.1) is different than the version being run (0.13.1).
This might happen because your dfx.json specifies an older version, or DFX_VERSION is set in your environment.
We are forwarding the command line to the old version. To disable this warning, set the DFX_WARNING=-version_check environment variable.

Error when trying to forward to project dfx:
Failed to get path to binary 'dfx' for version '0.12.1'.

Caused by:
    0: Failed to install binary cache for version '0.12.1'.
    1: Unknown version '0.12.1'.
Installed executable: 0.13.1
% dfx --version
dfx 0.13.1
% echo $DFX_VERSION

%

IIRC dfx searches all the way up to / for a dfx.json in case you're deep into e.g. a frontend folder. Any chance you have a dfx.json maybe in ~? If you want to, you can also do a global grep for the string "dfx": "0.12.1". This is most likely the string that's causing the version to be switched

Any chance you have a dfx.json maybe in ~? If you want to, you can also do a global grep for the string "dfx": "0.12.1". This is most likely the string that's causing the version to be switched

Yep, this was it! Closing.