-
Notifications
You must be signed in to change notification settings - Fork 670
CLI can't find global packages or npm. Maybe wrong path config? #4599
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
Comments
Can somebody help me here? This actively prevents me from using the cli.
EDIT: Found the error, going to submit a PR. |
It was an error in my project ionic.config.json. I switched from Windows to macOS and didn't notice the config used windows paths with backslashes. I think this error message is very misleading. |
What exactly did you have in |
{
"defaultProject": "first-project",
"projects": {
"first-project": {
"name": "First Project",
"integrations": {},
"type": "angular",
"root": "projects\\first-project"
},
"second-project": {
"name": "Second Project",
"integrations": {},
"type": "angular",
"root": "projects\\second-project"
},
"third-project": {
"name": "Third Project",
"integrations": {},
"type": "angular",
"root": "projects\\third-project"
}
}
} I had to change the names but this was exactly the structure. The paths in the root properties were made on windows which didn't work on macOS. |
Ahh, so the I'm wondering if it might be better to validate the project directory exists before we even attempt to spin up the serve CLI. I looked at your PR and realized we'd have to handle the same error in the build CLI and anywhere else we use that project directory as the cwd of the subprocess. |
Yeah exactly, sorry for missing out that information. My first attempt was also to check the cwd, but I wasn't sure if other parameters could cause this error too, so I just ended up checking the existance of the cli command itself. |
I believe your PR will only realistically fix this specific issue: that the subprocess can emit an I thought about this a bit more and I think you were pretty close. We probably do want this check to exist when we attempt to serve/build/generate. Here are some starting points:
I can take a look too, but it will be some time before I dig in. I'm mostly focused on Capacitor these days. Bugs in the Ionic CLI are rare, and this one looks like it will only affect devs who are using multiapp and make a typo in the project paths. If you intend to continue with a fix, let me know if you have any questions! I'd be happy to answer them. |
Description:
Hello there,
I'm currently trying to set up my dev environment on macOS Catalina 15.15.7. My problem is that the ionic cli
seems to ignore the paths of my angular cli.
Everytime I try to execute the
ionic serve
command, the cli wants me to install the angular cli because it can't find the ng command. When I try to install it it throws an exception as it can't find thenpm
command also.Steps to Reproduce:
npm install -g @angular/cli
ng --version
- Version 10.1.7npm install -g @ionic/cli
ionic --version
- Version 6.12.1npm install -r
ionic serve --project=<project-name>
ng
commandnpm
commandMy
ionic info
:Other Information:
Things I already tried
The text was updated successfully, but these errors were encountered: