我想开始使用ExtJS Community Edition
。我遵循此说明http://docs.sencha.com/extjs/6.6.0-CE/guides/getting_started/open_tooling.html。
我尝试执行命令:
ext-gen app -a
但是,我有这个错误:
i [ext]: ext-gen: E:\/cool-universal-app created
i [ext]: ext-gen: package.json created for cool-universal-app
i [ext]: ext-gen: webpack.config.js created for cool-universal-app
i [ext]: ext-gen: npm install -s started for cool-universal-app
i [ext]: ext-gen: npm install -s completed for cool-universal-app
(node:4908) UnhandledPromiseRejectionWarning: Error: Cannot find module 'E:\cool-universal-app\node_modules\@sencha\ext\package.json'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at stepCreate (C:\Users\pi\AppData\Roaming\npm\node_modules\@sencha\ext-gen\ext-gen.js:597:22)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:4908) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4908) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我的版本:
E:\>node -v
v10.10.0
E:\>npm -v
6.4.1
E:\>java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
怎么了?为什么会出现此错误?如何解决?
答案 0 :(得分:1)
在ext-gen中似乎有一个软件包优先级问题,因为它需要预先安装两个sencha软件包,而由于没有安装,因此会引发错误。
Sencha仍然没有解决此问题,因此我制作了一个小小的猴子补丁来解决它。 因此,打开“ C:\ Users \ pi \ AppData \ Roaming \ npm \ node_modules @ sencha \ ext-gen \ ext-gen.js”,然后在第597行之前添加以下行:
await util.spawnPromise(command, ['install', '@sencha/ext', '@sencha/cmd'], options, []);
最后,它必须看起来像这样:
await util.spawnPromise(command, ['install', '@sencha/ext', '@sencha/cmd'], options, []);
var frameworkPath = path.join(destDir, 'node_modules', npmScope, 'ext', 'package.json');
var cmdPath = path.join(destDir, 'node_modules', npmScope, 'cmd', 'package.json');