I want to run an ExpressJS app by using Powershell. It works with cmd when I use SET DEBUG=myApp:* & npm start
, but it won't work in the powershell. The error message is as follows:
At line:1 char:24
+ SET DEBUG=helloworld:* & npm start
+ ~
The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
+ CategoryInfo: ParserError: (:) [],ParentContainsErrorRecordException
+ FullyQualifiedErrorId : AmpersandNotAllowed
I've tried to eliminate the ampersand or wrap it around quotations marks but to no avail; I keep getting further error messages. I've googled this but haven't found the answer.
I want to know what is the command to be used in powershell to run my ExpressJS app.
By using some other commands suggested by other users, I get the following error:
PS C:\Users\User\myNode\helloworld> [Environment]::SetEnvironmentVariable("DEBUG","helloworld:"); & npm start At line:1 char:61 + [Environment]::SetEnvironmentVariable("DEBUG","helloworld:"); & np ... + ~ Missing ')' in method call. At line:1 char:61 + ... Environment]::SetEnvironmentVariable("DEBUG","helloworld:"); & npm ... + ~~ Unexpected token '' in expression or statement. At line:1 char:63 + ... nvironment]::SetEnvironmentVariable("DEBUG","helloworld:"); & npm ... + ~ Unexpected token ')' in expression or statement. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingEndParenthesisInMethodCall
PS C:\Users\User\myNode\helloworld> [Environment]::SetEnvironmentVariable("DEBUG","helloworld:* & npm start") PS C:\Users\User\myNode\helloworld>
PS C:\Users\hp\Desktop\myapp> set DEBUG='myapp:*'; npm start
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With