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

[Bug] Nx unable to find fvm despite being present in path #173

Closed
rohitsrao opened this issue May 15, 2023 · 10 comments
Closed

[Bug] Nx unable to find fvm despite being present in path #173

rohitsrao opened this issue May 15, 2023 · 10 comments

Comments

@rohitsrao
Copy link

Plugin Name

@nxrocks/nx-flutter

Nx Report

   Node   : 16.15.1
   OS     : darwin arm64
   pnpm   : 7.13.1
   Hasher : Native

   nx             : 16.1.4
   @nx/workspace  : 16.1.4
   @nx/devkit     : 16.1.4
   @nrwl/tao      : 16.1.4
   ---------------------------------------
   Community plugins:
   @nxrocks/nx-flutter : 7.0.3

Expected Behaviour

Expected plugin to create a flutter app using fvm

Actual Behaviour

> NX 'fvm' was not found on your system's PATH.

Please make sure you have installed it correctly.
👉🏾 https://fvm.app/docs/getting_started/installation
Pass --verbose to see the stacktrace.

I have installed fvm using homebrew and fvm is located at /opt/homebrew/bin/fvm and my PATH includes /opt/homebrew/bin:/opt/homebrew/sbin

Steps to reproduce the behaviour

1 - ran pnpm nx g @nxrocks/nx-flutter:create
2 - selected yes for the option "Are you using Flutter Version Manager"

@tinesoft
Copy link
Owner

Hi @rohitsrao ,

Thanks for using the plugin and for reporting this.

Can you confirm that fvm is globally found/accessible by running fvm --version in the same terminal where you ran the pnpm nx g @nxrocks/nx-flutter:create command?

@rohitsrao
Copy link
Author

Hi @tinesoft .

Thanks for the fast reply.

I am able to do that and get the following output

fvm --version
2.4.1

@tinesoft
Copy link
Owner

Humm 🤔...this looks like a bug indeed.

Can you add the --verbose flag to the pnpm nx g @nxrocks/nx-flutter:create command and paste in the full output?

I'll have a look at it

@rohitsrao
Copy link
Author

Thanks. Here you go.

pnpm nx g @nxrocks/nx-flutter:create --verbose

>  NX  Generating @nxrocks/nx-flutter:project

✔ What name would you like to use? · test
✔ What package name would you like to use? · com.test.test
✔ What is the project about? · testing flutter app creation using nx with fvm
✔ Which type of Flutter project would you like to create? · app
✔ Are you using Flutter Version Manager (fvm)? (y/N) · true
✔ Which platforms would you like to use? · android, ios, linux, windows, macos, web
✔ Which Android language would you like to use? · kotlin
✔ Which iOS language would you like to use? · swift
Generating Flutter project with following options : --project-name=test --org=com.test.test --description="testing flutter app creation using nx with fvm" --android-language=kotlin --ios-language=swift --template=app --platforms="android,ios,linux,windows,macos,web" ...

 >  NX   'fvm' was not found on your system's PATH.

   Please make sure you have installed it correctly.
   👉🏾 https://fvm.app/docs/getting_started/installation

Error: 'fvm' was not found on your system's PATH.
Please make sure you have installed it correctly.
👉🏾 https://fvm.app/docs/getting_started/installation
    at /Users/rohitsrao/Downloads/test-fvm/node_modules/.pnpm/@nxrocks+nx-flutter@7.0.3_zqbjo4rte6cxok4y43iraq25ve/node_modules/@nxrocks/nx-flutter/src/generators/project/lib/generate-project.js:13:19
    at Generator.next (<anonymous>)
    at /Users/rohitsrao/Downloads/test-fvm/node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js:167:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/rohitsrao/Downloads/test-fvm/node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js:163:16)
    at generateFlutterProject (/Users/rohitsrao/Downloads/test-fvm/node_modules/.pnpm/@nxrocks+nx-flutter@7.0.3_zqbjo4rte6cxok4y43iraq25ve/node_modules/@nxrocks/nx-flutter/src/generators/project/lib/generate-project.js:9:20)
    at /Users/rohitsrao/Downloads/test-fvm/node_modules/.pnpm/@nxrocks+nx-flutter@7.0.3_zqbjo4rte6cxok4y43iraq25ve/node_modules/@nxrocks/nx-flutter/src/generators/project/generator.js:48:48
    at Generator.next (<anonymous>)
    at fulfilled (/Users/rohitsrao/Downloads/test-fvm/node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js:164:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

@tinesoft
Copy link
Owner

Ok thanks!

I'll have a look tonight.
Stay tuned!

@rohitsrao
Copy link
Author

rohitsrao commented May 15, 2023

Should nx-flutter be installed globally ?

When I ran pnpm install --save-dev @nxrocks/nx-flutter I got the following error

 ERR_PNPM_ADDING_TO_ROOT  Running this command will add the dependency to the workspace root, which might not be what you want - if you really meant it, make it explicit by running this command again with the -w flag (or --workspace-root). If you don't want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.

So I installed it with pnpm install -w --save-dev @nxrocks/nx-flutter in my monorepo folder.

I installed it globally in a different attempt but I get the following error

pnpm nx g @nxrocks/nx-flutter:create --verbose

 >  NX   Unable to resolve @nxrocks/nx-flutter:create.

   unable to find tsconfig.base.json or tsconfig.json

Error: Unable to resolve @nxrocks/nx-flutter:create.
unable to find tsconfig.base.json or tsconfig.json
    at Workspaces.readGenerator (/Users/rohitsrao/Downloads/test-fvm/node_modules/.pnpm/nx@16.1.4/node_modules/nx/src/config/workspaces.js:151:19)
    at Object.<anonymous> (/Users/rohitsrao/Downloads/test-fvm/node_modules/.pnpm/nx@16.1.4/node_modules/nx/src/command-line/generate.js:226:209)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/rohitsrao/Downloads/test-fvm/node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js:164:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

@tinesoft
Copy link
Owner

Nx-flutter is a dev dependency in your workspace, so it can/must be installed in the root pacakage json file, as you did.

@tinesoft
Copy link
Owner

Hi @rohitsrao

Ok I've just re-read the installation instruction for fvm/flutter

https://fvm.app/docs/getting_started/installation/

Recommendation
We recommend install Flutter SDK globally using the official installation guide HERE. This will be the main version of Flutter across your machine.

Use FVM to manage the Flutter SDK version for your projects.

(emphasis are mine)

This means you need to install a main version of flutter. Then use fvm install/ fvm use <version> to install/use a specific version of flutter within your project.

And the the command to use to check the right setup is fvm flutter --version (and not just fvm --version)

Can you try that please and let me know?

@rohitsrao
Copy link
Author

@tinesoft Thanks. It is working now.

@tinesoft
Copy link
Owner

Awesome!

I'm closing this then

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

No branches or pull requests

2 participants