我想开始使用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)
怎么了?为什么会出现这个错误?怎样才能修复它?
发布于 2019-05-27 03:42:49
看起来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');
https://stackoverflow.com/questions/54724299
复制相似问题