typescript 找不到模块:错误无法解析“child_process”,如何解决?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/54459442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 05:47:06  来源:igfitidea点击:

Module not found: Error can't resolve 'child_process', how to fix?

node.jstypescriptnpmjupyter-lab

提问by OneTwo

I'm trying to create a JupyterLab extension, it uses typescript.

我正在尝试创建一个 JupyterLab 扩展,它使用打字稿。

I've successfully added the package "@types/node" allowing me to use packages such as 'require('http')'.

我已经成功添加了包“@types/node”,允许我使用诸如“require(‘http’)”之类的包。

But as soon as I try to use child process, using 'require("child_process")' I get the following error when trying to build the extension.

但是,一旦我尝试使用子进程,使用 'require("child_process")' 我在尝试构建扩展时收到以下错误。

ModuleNotFoundError: Module not found: Error: Can't resolve 'child_process' in '/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/lib' at factory.create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/webpack/lib/Compilation.js:535:10) at factory (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:397:22) at resolver (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:130:21) at asyncLib.parallel (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:224:22) at /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/neo-async/async.js:2825:7 at /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/neo-async/async.js:6886:13 at normalResolver.resolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:214:25) at doResolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:184:12) at hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn0 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) at resolver.doResolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5) at hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn0 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) at hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn0 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :12:1) at resolver.doResolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38) at hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn41 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :381:1) at resolver.doResolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:23:37) at hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn0 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) at hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn0 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) at args (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/forEachBail.js:30:14) at hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn0 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) at resolver.doResolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5) at hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn0 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) at hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) resolve 'child_process' in '/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/lib' Parsed request is a module using description file: /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/package.json (relative path: ./lib) Field 'browser' doesn't contain a valid alias configuration resolve as module /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/lib/node_modules doesn't exist or is not a directory /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/node_modules doesn't exist or is not a directory /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/node_modules doesn't exist or is not a directory /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/node_modules doesn't exist or is not a directory /home/fionn/anaconda3/envs/jupyterlab-ext/share/node_modules doesn't exist or is not a directory /home/fionn/anaconda3/envs/jupyterlab-ext/node_modules doesn't exist or is not a directory /home/fionn/anaconda3/envs/node_modules doesn't exist or is not a directory /home/fionn/anaconda3/node_modules doesn't exist or is not a directory /home/fionn/node_modules doesn't exist or is not a directory /home/node_modules doesn't exist or is not a directory /node_modules doesn't exist or is not a directory looking for modules in /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules using description file: /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/package.json (relative path: ./node_modules) Field 'browser' doesn't contain a valid alias configuration looking for modules in /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules using description file: /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/package.json (relative path: ./node_modules) Field 'browser' doesn't contain a valid alias configuration using description file: /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/package.json (relative path: .) no extension Field 'browser' doesn't contain a valid alias configuration using description file: /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/package.json (relative path: ./node_modules/child_process) no extension Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process is not a file .wasm Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process doesn't exist .wasm Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process.wasm doesn't exist .mjs Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process.wasm doesn't exist .mjs Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process.mjs doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process.mjs doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process.js doesn't exist .json Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process.js doesn't exist .json Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process.json doesn't exist /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process.json doesn't exist as directory existing directory use ./index.js from main in package.json using description file: /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/package.json (relative path: .) Field 'browser' doesn't contain a valid alias configuration as directory /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process doesn't exist using description file: /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/package.json (relative path: ./index.js) no extension Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js doesn't exist .wasm Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js.wasm doesn't exist .mjs Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js.mjs doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js.js doesn't exist .json Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js.json doesn't exist as directory /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js doesn't exist using path: /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index using description file: /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/package.json (relative path: ./index) no extension Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index doesn't exist .wasm Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.wasm doesn't exist .mjs Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.mjs doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js doesn't exist .json Field 'browser' doesn't contain a valid alias configuration /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.json doesn't exist error Command failed with exit code 1.

ModuleNotFoundError: Module not found: Error: Can't resolve 'child_process' in '/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/lib' at factory.create (/ home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/webpack/lib/Compilation.js:535:10) 在工厂 (/home/fionn/anaconda3/envs/jupyterlab-ext/ share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:397:22) 在解析器 (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/webpack/ lib/NormalModuleFactory.js:130:21) 在 asyncLib.parallel (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:224:22) 在 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/neo-async/async.js:2825:7 在 /home/fionn/anaconda3/envs/jupyterlab-ext /share/jupyter/lab/staging/node_modules/neo-async/async.js:6886:13 at normalResolver.resolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/ webpack/lib/NormalModuleFactory.js:214:25) 在 doResolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:184: 12) at hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn0 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) 在解析器。doResolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5) 在 hook.callAsync (/home/fionn/anaconda3) /envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn0 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext) /share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) 在 hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter /lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) 在 _fn0(在创建时评估(/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules) /tapable/lib/HookCodeFactory.js:32:10), :12:1) 在解析器。doResolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38) 在 hook.callAsync (/home/fionn/anaconda3) /envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn41 (eval at create (/home/fionn/anaconda3/envs/jupyterlab-ext) /share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :381:1) 在 resolver.doResolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter /lab/staging/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:23:37) 在 hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced -resolve/lib/Resolver.js:238:5)在_fn0(在创建时评估(/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10),:15:1)在 hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) at _fn0 (eval at create (/ home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) 在 args (/home/fionn/anaconda3/ envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/forEachBail.js:30:14) 在 hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/share/ jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5)在_fn0(在创建时评估(/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10),:15:1)在 resolver.doResolve (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5) 在 hook.callAsync (/home/ fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5)在_fn0(在创建时评估(/home/fionn/anaconda3/envs/ jupyterlab-ext/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:32:10), :15:1) 在 hook.callAsync (/home/fionn/anaconda3/envs/jupyterlab-ext/共享/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5) 解析'child_process'/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/lib' 解析请求是使用描述文件的模块:/home/fionn/anaconda3/envs/jupyterlab-ext/share /jupyter/lab/staging/node_modules/jupyerlab_xkdc/package.json(相对路径:./lib)字段“浏览器”不包含有效的别名配置解析为模块/home/fionn/anaconda3/envs/jupyterlab-ext/ share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/lib/node_modules 不存在或不是目录 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/node_modules 不存在' t 存在或不是目录 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/node_modules 不t 存在或不是目录 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/node_modules 不存在或不是目录 /home/fionn/anaconda3/envs/jupyterlab-ext/share/node_modules不存在或不是目录 /home/fionn/anaconda3/envs/jupyterlab-ext/node_modules 不存在或不是目录 /home/fionn/anaconda3/envs/node_modules 不存在或不是目录 /home/fionn/anaconda3/node_modules 不存在或不是目录 /home/fionn/node_modules 不存在或不是目录 /home/node_modules 不存在或不是目录 /node_modules 不存在't 存在或不是使用描述文件在 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules 中查找模块的目录:/home/fionn/anaconda3/envs/ jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/package.json(相对路径:./node_modules)字段“浏览器”不包含在 /home/fionn/anaconda3/ 中查找模块的有效别名配置envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules 使用描述文件:/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/package.json(相对路径:./node_modules ) 字段“浏览器”不包含使用描述文件的有效别名配置:/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/package.json(相对路径:.)无扩展名字段“浏览器”不包含使用描述的有效别名配置文件:/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/package.json(相对路径:./node_modules/child_process)没有扩展字段“浏览器”不包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process 不是文件 .wasm 字段“浏览器”不t 包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process 不存在 .wasm 字段“浏览器”不包含有效别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process.wasm 不存在 .mjs 字段“浏览器”不包含有效的别名配置 /home/fionn /anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process.wasm 不存在 .mjs 字段“浏览器”不存在t 包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process.mjs 不存在 .js 字段“浏览器”不包含有效的别名配置/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process.mjs 不存在 .js 字段“浏览器”不包含有效的别名配置 /home /fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process.js 不存在 .json 字段“浏览器”不存在t 包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process.js 不存在 .json 字段“浏览器”不包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process.json 不存在 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter /lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process.json 不存在,因为目录现有目录使用 package.json 中的 main 中的 ./index.js 使用描述文件:/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/package.json(相对路径:.)字段“浏览器”不包含作为目录/home的有效别名配置/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/jupyerlab_xkdc/node_modules/child_process 不存在使用描述文件:/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter /lab/staging/node_modules/child_process/package.json(相对路径:./index.js)无扩展名字段'浏览器'不包含有效的别名配置/home/fionn/anaconda3/envs/jupyterlab-ext/share /jupyter/lab/staging/node_modules/child_process/index.htmljs 不存在 .wasm 字段“浏览器”不包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js.wasm 不'不存在 .mjs 字段 'browser' 不包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js.mjs 不包含存在 .js 字段“浏览器”不包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js.js 不包含t 存在 .json 字段“浏览器”不包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js.json 不存在作为目录 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js 不存在使用路径:/home/fionn/anaconda3/envs/jupyterlab-ext/ share/jupyter/lab/staging/node_modules/child_process/index 使用描述文件:/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/package.json(相对路径:. /index) 无扩展字段 'browser' 不包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index 不存在 .wasm 字段 'browser' 不包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.wasm 不存在 .mjs 字段“浏览器”不包含有效的别名配置/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.mjs 不存在 .js 字段“浏览器”不存在t 包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.js 不存在 .json 字段“浏览器”不包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.json 不存在错误命令失败,退出代码为 1。t 包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.json 不存在错误命令失败,退出代码为 1。t 包含有效的别名配置 /home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/child_process/index.json 不存在错误命令失败,退出代码为 1。

I've googled around but still have no idea what to do to resolve this issue.

我已经谷歌搜索,但仍然不知道如何解决这个问题。

Any pointers or info at all would be greatly appreciated.

任何指针或信息都将不胜感激。

My packages.json file.

我的packages.json 文件。

{
  "name": "jupyerlab_xkdc",
  "version": "0.1.0",
  "description": "Short description",
  "keywords": [
    "jupyter",
    "jupyterlab",
    "jupyterlab-extension"
  ],
  "homepage": "https://github.com/my_name/myextension",
  "bugs": {
    "url": "https://github.com/my_name/myextension/issues"
  },
  "license": "BSD-3-Clause",
  "author": "Fionn McKnight",
  "files": [
    "lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
    "style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
  ],
  "main": "lib/index.js",
  "types": "lib/index.d.ts",
  "repository": {
    "type": "git",
    "url": "https://github.com/my_name/myextension.git"
  },
  "scripts": {
    "build": "tsc",
    "clean": "rimraf lib",
    "prepare": "npm run clean && npm run build",
    "watch": "tsc -w"
  },
  "dependencies": {
    "@jupyterlab/application": "^0.19.1",
    "@jupyterlab/apputils": "^0.19.1",
    "@phosphor/coreutils": "^1.3.0",
    "@phosphor/messaging": "^1.2.2",
    "@phosphor/widgets": "^1.6.0",
    "@types/jquery": "^3.3.29",
    "@types/node": "^10.12.19",
    "child_process": "^1.0.2",
    "npm": "^6.7.0"
  },
  "devDependencies": {
    "@types/node": "^10.12.19",
    "rimraf": "^2.6.1",
    "typescript": "~3.1.1"
  },
  "jupyterlab": {
    "extension": true
  }
}

回答by Shubham Tiwari

just put in package.json

只需放入 package.json

"browser":{
"child_process": false
}  

are you using webpack

你在用 webpack