前端打包编译报错

  • Choerodon平台版本: 0.21.0

  • 遇到问题的执行步骤:
    前端打包编译报错

  • 源码

{
  "name": "@choerodon/choerodon-front",
  "routeName": "c7n",
  "version": "0.21.0",
  "description": "Choerodon Front",
  "scripts": {
    "start": "choerodon-front-boot start --config ./react/config.js",
    "dist": "node --max_old_space_size=4096 node_modules/@choerodon/boot/bin/choerodon-front-boot-dist --config ./react/config.js",
    "clean": "rm -rf ./src"
  },
  "contributors": [
    "choerodon"
  ],
  "license": "ISC",
  "dependencies": {
    "@choerodon/boot": "0.20.0",
    "@choerodon/master": "0.21.0",
    "choerodon-ui": "^0.8.11",
    "@choerodon/base": "0.21.0",
    "@choerodon/devops": "0.21.0",
    "@choerodon/asgard": "0.21.0",
    "@choerodon/notify": "0.21.0",
    "@choerodon/manager": "0.20.0",
    "@choerodon/agile": "0.21.0",
    "@choerodon/testmanager": "0.21.0",
    "@choerodon/knowledge": "0.21.0"
  }
}
  • 报错日志:
"D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run dist --scripts-prepend-node-path=auto

> @choerodon/choerodon-front@0.21.0 dist D:\github\choerodon-test\choerodon-front
> node --max_old_space_size=4096 node_modules/@choerodon/boot/bin/choerodon-front-boot-dist --config ./react/config.js

�  building modules (134/157 modules)(node:14444) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, se
e https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
�  building modules (7365/7365 modules)Extracted theme color css content length: 47623

webpack: bundle build is now finished.


 ERROR  Failed to compile with 1 errors                                                                                                       9:40:10 PM

This dependency was not found:

* D:\github\choerodon-test\choerodon-front\node_modules\@choerodon\manager\lib\src\app\iam\containers\IAMIndex.js in ./node_modules/@choerodon/boot/tmp/
routes.index.js

To install it, you can run: npm install --save D:\github\choerodon-test\choerodon-front\node_modules\@choerodon\manager\lib\src\app\iam\containers\IAMIn
dex.js
Warning:
ERROR in ./node_modules/@choerodon/boot/tmp/routes.index.js
Module not found: Error: Can't resolve 'D:\github\choerodon-test\choerodon-front\node_modules\@choerodon\manager\lib\src\app\iam\containers\IAMIndex.js'
 in 'D:\github\choerodon-test\choerodon-front\node_modules\@choerodon\boot\tmp'
 @ ./node_modules/@choerodon/boot/tmp/routes.index.js 57:44-177
 @ ./node_modules/@choerodon/boot/tmp/entry.index.js

ERROR in Encountered an error while minifying dis/chunks/303.bfa4c.chunk.js:
SyntaxError: Unexpected token: punc «.»
  59822 |   var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  59823 |
> 59824 |   if (!new.target) throw new Error('ConfigNode() must be called with new');
        |          ^
  59825 |
  59826 |   this.temp = '=';
  59827 |   this.key = key;

Process finished with exit code 0

  • 原因分析:

    可能打包插件出错

您好,您先手动将@choerodon/manager的版本改成0.20.1,再执行命令,我们在修复版本了。

同样报错,报错信息如下

"D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run dist --scripts-prepend-node-path=auto

> @choerodon/choerodon-front@0.21.0 dist D:\github\choerodon-test\choerodon-front
> node --max_old_space_size=4096 node_modules/@choerodon/boot/bin/choerodon-front-boot-dist --config ./react/config.js

�  building modules (134/150 modules)(node:4840) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see
 https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
�  building modules (7466/7466 modules)Extracted theme color css content length: 48202

webpack: bundle build is now finished.


 ERROR  Failed to compile with 1 errors                                                                                                      10:51:07 AM

 error 

Encountered an error while minifying dis/chunks/312.95226.chunk.js:
SyntaxError: Unexpected token: punc «.»
  59364 |   var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  59365 |
> 59366 |   if (!new.target) throw new Error('ConfigNode() must be called with new');
        |          ^
  59367 |
  59368 |   this.temp = '=';
  59369 |   this.key = key;

Warning:
ERROR in Encountered an error while minifying dis/chunks/312.95226.chunk.js:
SyntaxError: Unexpected token: punc «.»
  59364 |   var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
  59365 |
> 59366 |   if (!new.target) throw new Error('ConfigNode() must be called with new');
        |          ^
  59367 |
  59368 |   this.temp = '=';
  59369 |   this.key = key;

Process finished with exit code 0

您好,这个报错不影响哈。


相同版本,fron npm run dist 编译报这个错了 ,node_modules已经设置权限

检查一下@choerodon/agile版本号

我们把front 版本 换到0.21.5了,能编译成静态文件.

但是访问得时候,跳转auth路径不对

访问localhost:8080
跳转到下面地址了
···
http://localhost:8080/undefined/oauth/oauth/authorize?response_type=token&client_id=localhost&state=&redirect_uri=http%3A//localhost%3A8080/%23/projects%3Fcategory%3DDEFAULT%26id%3D2%26name%3D%E8%BF%90%E8%90%A5%E7%BB%84%E7%BB%87%26organizationId%3D2%26type%3Dorganization%3FredirectFlag
···

这个是后端API地址配置不对 API_HOST

@choerodon/manager 有0.20.1tag的源码吗? 或者有哪一个版本源码适用于总前端0.21.2的版本吗