在 Windows PowerShell 中执行 yarn 相关命令时报错:不允许使用与号(&)
1、在 Windows PowerShell 中执行 yarn 相关命令时报错:不允许使用与号(&)。如图1
PS E:\wwwroot\with-blade> yarn hotishop theme build & hotishop app build --all 所在位置 行:1 字符: 27 + yarn hotishop theme build & hotishop app build --all + ~ 不允许使用与号(&)。& 运算符是为将来使用而保留的;请用双引号将与号引起来("&"),以将其作为字符串的一部分传递。 + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : AmpersandNotAllowed
2、决定将 & 替换为 “&”,然后执行:yarn hotishop theme build 成功后,报错:’hotishop’ 不是内部或外部命令,也不是可运行的程序或批处理文件。
PS E:\wwwroot\with-blade> yarn hotishop theme build "&" hotishop app build --all ... @theme/brooklyn: √ Mix: Compiled successfully in 2.73m @theme/brooklyn: webpack compiled successfully lerna success run Ran npm script 'prod' in 1 package in 180.7s: lerna success - @theme/brooklyn Done in 288.18s. 'hotishop' 不是内部或外部命令,也不是可运行的程序 或批处理文件。
3、在第 2 个 hotishop 之前添加 yarn ,最后两个 build 皆成功运行。如图2
PS E:\wwwroot\with-blade> yarn hotishop theme build "&" yarn hotishop app build --all yarn run v1.22.15 $ E:\wwwroot\with-blade\node_modules\.bin\hotishop theme build ~ Removing apps from "./themes/brooklyn/apps/internal" ... $ E:\wwwroot\with-blade\node_modules\.bin\lerna run --scope @theme/brooklyn prod lerna notice cli v6.6.2 ... @theme/brooklyn: √ Mix: Compiled successfully in 2.80m @theme/brooklyn: webpack compiled successfully lerna success run Ran npm script 'prod' in 1 package in 216.7s: lerna success - @theme/brooklyn Done in 253.16s. yarn run v1.22.15 $ E:\wwwroot\with-blade\node_modules\.bin\hotishop app build --all $ E:\wwwroot\with-blade\node_modules\.bin\lerna run --scope @extension/* prod lerna notice cli v6.6.2 lerna info versioning independent lerna notice filter including "@extension/*" lerna info filter [ '@extension/*' ] lerna info Executing command in 28 packages: "yarn run prod" @extension/back-top: $ mix --production ... lerna success - @extension/visitors-counter √ Done! Done in 770.26s.
近期评论