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
pode CLI cmd does not work as expected. Causes The term './Server.ps1' is not recognized as the name of a cmdlet, function, script or operable program
#429
Comments
Hey @larssb, So for PS> powershell /c "write-host 'hello'"
hello
PS> powershell -c "write-host 'hello'"
hello I did replace The only way I could get the same error was to follow your steps literally:
I noticed that between the two you're not creating a C:\Projects\Temp> pode init
name (Temp):
version (1.0.0):
description:
entry point (./server.ps1):
author:
license (MIT):
Success, saved package.json
C:\Projects\Temp> pode start
./server.ps1 : The term './server.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ ./server.ps1
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (./server.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException Is this the same case for yourself? In which case would you prefer |
Hi @Badgerati Thank you for replying so fast. I did have a Server.ps1 file before executing
However, I do not see why this should not work. Of course I updated the package.json after executing I just tried dot invoking. So in I also tried moving my Server.ps1 file into my projects root folder. So that is side-by-side the package.json file. Update the package.json file to reflect this. Same error:
So maybe dot-invocation is the way to go? What do you think? |
Hi @larssb, So a sub-folder was what I was missing before, but I've just tried it on my side and it works 😕. This is the folder hierarchy and package.json I have:
{
"version": "1.0.0",
"license": "MIT",
"name": "test",
"scripts": {
"test": "invoke-pester ./tests/*.ps1",
"install": "yarn install --force --ignore-scripts --modules-folder pode_modules",
"build": "psake",
"start": "./api/server.ps1"
},
"description": "",
"author": "",
"main": "./api/server.ps1"
} Running On the dot-invocation, I was originally using that method! Unfortunately it was causing havoc with the FileWatcher, and using |
Hey @larssb, Good news! Using Let me know if |
Yes that works. I just tested it. Looks great. Hopefully this can get out in the next release of Pode. Good 1 |
Excellent! Yes, I'll get this into the next release. |
Describe the Bug
pode cli cmd start does throws.
The term './Server.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Steps To Reproduce
Steps to reproduce the behavior:
0. Execute
pode init
pode start
Expected Behavior
I expected
pode start
to work by starting the Pode server.Platform
Additional Context
In my troubleshooting I went through the Pode code used to start the server. Here I see that on the Windows platform, the server is initiated by executing
powershell /c "$($ActionScript)"
. This seems to be the culprit.When trying
powershell /?
in e.g. -> WindowsKey+R. I don't see the /c option anywhere. Shouldn't it be the-Command
parameter that was used here instead?Anyways PowerShell do not interpret the
$(ActionScript)
part as executable code. I've successfully used the following approact:powershell -command & { POWERSHELL_CODE_TO_EXECUTE }
I hope I describe myself clearly in the above. If not I'll be happy to further elaborate.
Thank you
The text was updated successfully, but these errors were encountered: