Ant-design-pro: 当安装了其他依赖之后就出现 These dependencies were not found

Created on 28 Sep 2018  ·  5Comments  ·  Source: ant-design/ant-design-pro

  1. 安装了其他的包,npm install --save egg-view-assets egg-view-nunjucks
  2. 重新执行npm start 报一下错误
ERROR  Failed to compile with 2 errors                                               16:12:56

These dependencies were not found:

* egg-view-assets in dll umi
* egg-view-nunjucks in dll umi

To install them, you can run: npm install --save egg-view-assets egg-view-nunjucks
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `cross-env APP_TYPE=site umi dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

2313 也是同样问题,全局安装umi不能解决问题,也不是正确的解决方式

Most helpful comment

npm install --save--dev egg-view-assets egg-view-nunjucks
试试这个行不行

不行,实际已经安装,经排查是umi-plugin-dll 的问题,他会将dependencies的包打包到umi-dlls, 以加速webpack构建重启,而egg-view-nunjucks 等包的package.json 没有设置main的入口文件,因此找不到此包。
解决办法:
暂时先关闭dll插件:/config/config.js 注释 dll 一段,或将不能编译到dll的包添加到 exclude: [...]

        ...(!process.env.TEST && os.platform() === 'darwin'
          ? {
              dll: {
                include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
                exclude: [
                  '@babel/runtime',
                  'egg',
                  'egg-view-assets',
                  'egg-view-nunjucks',
                ],
              },
              hardSource: true,
            }
          : {}),

All 5 comments

npm install --save--dev egg-view-assets egg-view-nunjucks
试试这个行不行

npm install --save--dev egg-view-assets egg-view-nunjucks
试试这个行不行

不行,实际已经安装,经排查是umi-plugin-dll 的问题,他会将dependencies的包打包到umi-dlls, 以加速webpack构建重启,而egg-view-nunjucks 等包的package.json 没有设置main的入口文件,因此找不到此包。
解决办法:
暂时先关闭dll插件:/config/config.js 注释 dll 一段,或将不能编译到dll的包添加到 exclude: [...]

        ...(!process.env.TEST && os.platform() === 'darwin'
          ? {
              dll: {
                include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
                exclude: [
                  '@babel/runtime',
                  'egg',
                  'egg-view-assets',
                  'egg-view-nunjucks',
                ],
              },
              hardSource: true,
            }
          : {}),

应该要include的才会被打包到dll吧?

应该要include的才会被打包到dll吧?

看源码是include + dependencies, 所以dependencies且只用在服务端、没有index文件、没有配置 main 属性的这种npm 包,需要排除掉

@sorrycc

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhongjiewu picture zhongjiewu  ·  3Comments

952425340 picture 952425340  ·  3Comments

yaoleiroyal picture yaoleiroyal  ·  3Comments

Jerry-goodboy picture Jerry-goodboy  ·  3Comments

RichardStark picture RichardStark  ·  3Comments