gpt4 book ai didi

node.js - 如何使用 powershell 运行 Express 应用程序

转载 作者:搜寻专家 更新时间:2023-10-31 23:59:17 27 4
gpt4 key购买 nike

我想使用 Powershell 运行 ExpressJS 应用程序。当我使用 SET DEBUG=myApp:* & npm start 时它与 cmd 一起工作,但它在 powershell 中不起作用。错误信息如下:

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

我试图消除和号或将其用引号括起来,但无济于事;我不断收到更多错误消息。我用谷歌搜索了这个,但没有找到答案。

我想知道在 powershell 中用来运行我的 ExpressJS 应用程序的命令是什么。

通过使用其他用户建议的一些其他命令,我得到以下错误:

PS C:\Users\User\myNode\helloworld> [环境]::SetEnvironmentVariable("DEBUG","helloworld:"‌ ); & npm 开始在行:1 字符:61+ [环境]::SetEnvironmentVariable("DEBUG","helloworld:"‌ ); & np ...+ ~方法调用中缺少“)”。在行:1 字符:61+ ... 环境]::SetEnvironmentVariable("DEBUG","helloworld:"‌ ); & npm ...+ ~~表达式或语句中出现意外标记“‌ ”。在行:1 字符:63+ ... nvironment]::SetEnvironmentVariable("DEBUG","helloworld:"‌ ); & npm ...+ ~表达式或语句中出现意外标记“)”。 + 类别信息:ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingEndParenthesisInMethodCall

PS C:\Users\User\myNode\helloworld> [环境]::SetEnvironmentVariable("DEBUG","helloworld:* & npm start")PS C:\Users\User\myNode\helloworld>

最佳答案

PS C:\Users\hp\Desktop\myapp> set DEBUG='myapp:*'; npm 开始

关于node.js - 如何使用 powershell 运行 Express 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42095967/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com