首页 > 解决方案 > 如何修复“未找到模块:错误:无法解析 'mvc/form/form-repeat'”?

问题描述

我正在尝试构建一个节点包,该包使用另一个名为“客户端” 的节点包https://github.com/galaxyproject/galaxy/tree/release_21.01/client作为依赖项。

我通过创建一个 conda env 来构建这个包

conda create -n galaxy-lab JupyterLab=2.2.9 ipywidgets=7.5.1 nodejs=14.15.1 -y

并创建一个本地注册表以便于安装。

这个包安装在node_module我的新包目录下galaxy-client

当我尝试从galaxy-client依赖项中导入对象并尝试运行命令时npm run build...

import {FormSection} from "galaxy-client/src/mvc/form/form-section";


export class  Form extends FormSection {


}

命令抛出一堆错误,

The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

ERROR in ./node_modules/galaxy-client/src/mvc/form/form-section.js 7:0-32
Module not found: Error: Can't resolve 'utils/utils' in '/Users/user/Desktop/push/galaxylab/node_modules/galaxy-client/src/mvc/form'
 @ ./src/test.ts 7:23-73
 @ ./src/index.ts 16:13-30

ERROR in ./node_modules/galaxy-client/src/mvc/form/form-section.js 8:0-40
Module not found: Error: Can't resolve 'mvc/ui/ui-portlet' in '/Users/user/Desktop/push/galaxylab/node_modules/galaxy-client/src/mvc/form'
 @ ./src/test.ts 7:23-73
 @ ./src/index.ts 16:13-30

ERROR in ./node_modules/galaxy-client/src/mvc/form/form-section.js 9:0-42
Module not found: Error: Can't resolve 'mvc/form/form-repeat' in '/Users/user/Desktop/push/galaxylab/node_modules/galaxy-client/src/mvc/form'
 @ ./src/test.ts 7:23-73
 @ ./src/index.ts 16:13-30

ERROR in ./node_modules/galaxy-client/src/mvc/form/form-section.js 10:0-47
Module not found: Error: Can't resolve 'mvc/form/form-input' in '/Users/user/Desktop/push/galaxylab/node_modules/galaxy-client/src/mvc/form'
 @ ./src/test.ts 7:23-73
 @ ./src/index.ts 16:13-30

ERROR in ./node_modules/galaxy-client/src/mvc/form/form-section.js 11:0-50
Module not found: Error: Can't resolve 'mvc/form/form-parameters' in '/Users/user/Desktop/push/galaxylab/node_modules/galaxy-client/src/mvc/form'
 @ ./src/test.ts 7:23-73
 @ ./src/index.ts 16:13-30

5 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.27.1 compiled with 5 errors and 1 warning in 11334 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @galaxy/galaxylab@0.1.0 build: `yarn run build:lib && yarn run build:nbextension`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @galaxy/galaxylab@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2021-03-26T14_07_36_547Z-debug.log

我试图改变相对路径galaxy-client但是客户端的目录结构非常复杂。最终,我意识到更改“客户端”包的原始代码并不是一个好主意。如何在不更改“客户端”包的原始代码的情况下解决此错误,请建议?

这是依赖项的链接:

https://github.com/galaxyproject/galaxy/tree/release_21.01/client

标签: javascriptnode.jsnpmnode-modulesnpm-install

解决方案


推荐阅读