【发布时间】:2021-08-17 12:58:10
【问题描述】:
我正在尝试使用 Lifray 7.1 上的 yo 主题生成器生成主题。我按照下面链接上的步骤操作,我的问题是在运行此命令“npm install -g yo”时无法正确安装 yo。不知道为什么?!但这就是我得到的:
C:\Windows\system32>npm install --global yo
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
C:\Users\hdala\AppData\Roaming\npm\yo -> C:\Users\hdala\AppData\Roaming\npm\node_modules\yo\lib\cli.js
C:\Users\hdala\AppData\Roaming\npm\yo-complete -> C:\Users\hdala\AppData\Roaming\npm\node_modules\yo\lib\completion\index.js
> yo@4.2.0 postinstall C:\Users\hdala\AppData\Roaming\npm\node_modules\yo
> yodoctor
Yeoman Doctor
Running sanity checks on your system
√ No .bowerrc file in home directory
√ Global configuration file is valid
√ NODE_PATH matches the npm root
√ No .yo-rc.json file in home directory
√ Node.js version
√ npm version
{ Error: Command failed: C:\Windows\system32\cmd.exe /s /c "yo "--version""
C:\Users\hdala\AppData\Roaming\npm\node_modules\yo\node_modules\yeoman-environment\lib\environment.js:534
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\hdala\AppData\Roaming\npm\node_modules\yo\lib\router.js:8:27)
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at ChildProcess.cp.emit (C:\Users\hdala\AppData\Roaming\npm\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:37:29)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "yo "--version""' }
× yo version
{ Error: Command failed: C:\Windows\system32\cmd.exe /s /c "yo "--version""
C:\Users\hdala\AppData\Roaming\npm\node_modules\yo\node_modules\yeoman-environment\lib\environment.js:534
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\hdala\AppData\Roaming\npm\node_modules\yo\lib\router.js:8:27)
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at ChildProcess.cp.emit (C:\Users\hdala\AppData\Roaming\npm\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:37:29)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
killed: false,
code: 1,
signal: null,
cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "yo "--version""' }
Found potential issues on your machine :(
+ yo@4.2.0
updated 1 package in 47.053s
C:\Windows\system32>yo doctor
C:\Users\hdala\AppData\Roaming\npm\node_modules\yo\node_modules\yeoman-environment\lib\environment.js:534
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\hdala\AppData\Roaming\npm\node_modules\yo\lib\router.js:8:27)
https://help.liferay.com/hc/en-us/articles/360018166591-Creating-Themes
【问题讨论】:
标签: node.js liferay-7 liferay-theme yo