Reputation: 171
I have to execute following command from VS Code Terminal. I am running my application in windows 10 machine.
set DEBUG=app & node app.js
when I run the above command the terminal gives me following error message.
At line:1 char:15
+ set DEBUG=app & node app.js
+ ~
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
However when I run the same command from command window separately it executes fine as expected.
Upvotes: 11
Views: 4999
Reputation: 4103
You can create script in package.json
:
scripts:{
"start": "set DEBUG=app;node app.js"
}
and run with command:
yarn run start // or npm run start (if you use npm)
set
just can use for window, my suggest is use cross-env.
Upvotes: 1
Reputation: 15639
Replace &
with ;
like this.
set DEBUG=app;node app.js
VSCode
uses Powershell
as its terminal, And In Powershell
the command separator is ;
NOT &
Hope this helps!
Upvotes: 17