Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: for dfx new failure if node is installed but npm is not #3723

Merged
merged 9 commits into from
Apr 24, 2024

Conversation

ericswanson-dfinity
Copy link
Member

Description

dfx new would fail with "Failed to scaffold frontend code" if node was installed, but npm was not installed.

Also, now checks the status code when calling node and npm to see if they are installed. This means if there is a script that outputs something like the below, dfx will no longer assume the program is installed.

$ npm
Command 'npm' not found, but can be installed with: apt install npm
Please ask your administrator.

How Has This Been Tested?

Added an e2e test

Checklist:

  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

Would fail with "Failed to scaffold frontend code"

Also, now checks the status code when calling node and npm to
see if they are installed. This means if there is a script
that outputs something like the below, dfx will no longer assume
the program is installed.

$ npm
Command 'npm' not found, but can be installed with:
apt install npm
Please ask your administrator.
assert_command dfx new e2e_project1 --type motoko --frontend sveltekit
assert_contains "Node could not be found. Skipping installing the frontend example code."
assert_contains "npm could not be found. Skipping installing the frontend example code."
assert_contains "You can bypass this check by using the --frontend flag."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The executed command has the --frontend flag.
IIUC, this line "You can bypass this check by using the --frontend flag." cannot be true.
The instruction might be outdated after the big dfx new rewrite.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but adjacent work in the context of this PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ericswanson-dfinity ericswanson-dfinity marked this pull request as draft April 23, 2024 19:25
@ericswanson-dfinity ericswanson-dfinity marked this pull request as ready for review April 23, 2024 22:05
@lwshang lwshang merged commit df0ffe7 into master Apr 24, 2024
179 checks passed
@lwshang lwshang deleted the ens/fix-missing-npm branch April 24, 2024 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants