piral: Scaffolding a Piral Instance Fails in Windows
Bug Report
For more information, see the CONTRIBUTING guide.
Prerequisites
- Can you reproduce the problem in a MWE?
- Are you running the latest version?
- Did you perform a search in the issues?
Environment Details and Version
piral@0.11.1 Windows
Description
Trying to follow the tutorial#1 getting started, says to run piral new --target my-app, following this fails to run. It gives me a blank folder with a package.json and nothing else.
Steps to reproduce
$ piral new --target app-shell
> Codes Reference: https://docs.piral.io/code/search
Expected behavior
There should be a new piral instance there with the correct template
Actual behavior
The folder was empty and piral debug fails.
Possible Origin / Solution
The tutorials may be out of date?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 47 (45 by maintainers)
Commits related to this issue
- Improved the Piral CLI, enhanced logger #192 — committed to smapiot/piral by FlorianRappl 4 years ago
- Added secondary resolver on Windows #192 — committed to smapiot/piral by FlorianRappl 4 years ago
- Next try to tackle #192 — committed to smapiot/piral by FlorianRappl 4 years ago
- Improved path resolution on Windows #192 — committed to smapiot/piral by FlorianRappl 3 years ago
Great - thanks @axinom-benjamin for the insight.
I guess I now have the right pointer. What we do is that we add the local
node_modules/.binfolder to the PATH, but we assume that the global one is in the path. Apparently, it is not always given.I’ll figure out a way to check that beforehand and potentially add it.
Thanks again for helping here! 🍻
Looks like this is windows only, ran in WSL (Ubuntu) and the scaffold worked just fine.
@FlorianRappl Thanks for pointing that out, and I had to rework my fix. Spawning a child process still looks for the
PATHproperty on theenvoptions, so I made the change only for a Windows environment. See changes in PR https://github.com/smapiot/piral/pull/444Our organization has just started looking into piral as an alternative microfrontend framework.
We encountered a possibly-related issue where, in some environments, the
piral buildalso had a problem finding the npm command during the packaging step of the piral instance.Tracked it down to a Windows environment where nodejs is not installed in the standard location because it was installed as non-administrator. In this case,
npm.cmdwas installed in some path likeC:\Users\USER\apps\nodejsand that path is added to the WindowsPATHenvironment variable.As discovered in https://github.com/smapiot/piral/issues/192#issuecomment-615106475, the
scripts.tscode is incorrectly using theenvobjectPathproperty because of case-sensitivity as described in https://github.com/nodejs/node/issues/20605Fixed it in
scripts.tswith the following (changing allenv.PATHtoenv.Path):I’d like to initiate a PR, but I get failures on the latest develop branch on building
piral-cli-webpack5.still the same after
npm cache clean --forceBut I agree that this issue is not worth hunting further. It sees not really wide-spread and most likely some strange configuration that is happening on my machine. Since there are also very feasible workarounds, so it’s not a critical issue at all.
The workarounds (that work on my machine) for the protocol:
The only thing that doesn’t work is: running it using npx from inside the integrated terminal in VS Code.
Still, thanks for all the time spent trying to find the issue!
no news, unfortunately - working around it by not using the integrated terminal for the CLI.
not sure if it helps anything, but the issue is not happening when using the integrated (bash) terminal of my WSL.
I guess it may be due to the way the options are provided. But then not sure why it works in one PS and not in the other. I would expect some issue, e.g., with CMD.
Definitely interesting … Thanks for the investigation so far! 🍻
I did some more tries and it’s working for me when I use PowerShell directly, but it fails when I run it from the Visual Studio Code integrated PowerShell. The output on the integrated PowerShell is:
It created the
app-shellfolder but it only contains apackage.json, nothing more.