Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

例子中的ssr-with-eggjs项目运行报错 #5099

Closed
immisso opened this issue Jul 25, 2020 · 19 comments · Fixed by #5486
Closed

例子中的ssr-with-eggjs项目运行报错 #5099

immisso opened this issue Jul 25, 2020 · 19 comments · Fixed by #5486
Labels

Comments

@immisso
Copy link

immisso commented Jul 25, 2020

What happens?

例子中的ssr-witch-eggjs项目运行报错

 ERROR  Failed to compile with 1 errors                                                                                 16:32:56
 error  in ./app/web/.umi/umi.ts

Module parse failed: Unexpected token (13:29)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| require('./plugin-locale/locale')._onCreate();
|
> const getClientRender = (args: { hot?: boolean } = {}) => plugin.applyPlugins({
|   key: 'render',
|   type: ApplyPluginsType.compose,

 @ multi ./app/web/.umi/umi.ts
2020-07-25 16:31:01,187 ERROR 12908 [-/::1/-/7ms GET /] nodejs.Error: Module parse failed: Unexpected token (22:12)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|  * @param params
|  */
> const render: IServerRender = async (params) => {
|   let error;
|   const {
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|  * @param params
|  */
> const render: IServerRender = async (params) => {
|   let error;
|   const {
    at Object../app/web/.umi/core/server.ts (E:\Project\e7la\app\public\umi.server.js:97:7)
    at __webpack_require__ (E:\Project\e7la\app\public\umi.server.js:21:30)
    at Object.0 (E:\Project\e7la\app\public\umi.server.js:108:18)
    at __webpack_require__ (E:\Project\e7la\app\public\umi.server.js:21:30)
    at E:\Project\e7la\app\public\umi.server.js:85:18
    at Object.<anonymous> (E:\Project\e7la\app\public\umi.server.js:88:10)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)

pid: 12908
hostname: DESKTOP-A9V2S71

最小可复现仓库

请使用 yarn create @umijs/umi-app 创建,并上传到你的 GitHub 仓库

复现步骤,错误日志以及相关配置

按照README.md里的步骤运行报错

相关环境信息

  • Umi 3.2.10
  • Node 12.13.0
  • 操作系统:Window
@immisso immisso changed the title 例子中的ssr-witch-eggjs项目运行报错 例子中的ssr-with-eggjs项目运行报错 Jul 26, 2020
@ycjcl868 ycjcl868 added the type(ssr) UmiJS SSR label Jul 26, 2020
@xxxxxMiss
Copy link

+1

@williamnie
Copy link
Contributor

3.2.9跑的起来么?或者升级到最新版本试试,还不行的话留言,我查一下

@xxxxxMiss
Copy link

3.2.9跑的起来么?或者升级到最新版本试试,还不行的话留言,我查一下

不行,升级到最新的3.3.0-alpha.0依然存在上面的错误。

3.2.9版本还遇到如下问题错误:

ERROR 22028 nodejs.EPERMError: EPERM: operation not permitted, watch
    at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:127:28)
errno: -4048
syscall: "watch"
code: "EPERM"
filename: null

按照网上办法各种解决权限问题,依然不行。
以上问题,都是在windows系统上出现的问题,mac上完全OK

@immisso
Copy link
Author

immisso commented Jul 31, 2020

3.2.9跑的起来么?或者升级到最新版本试试,还不行的话留言,我查一下

升级到最新版本依然上面的错误!

@appzk
Copy link

appzk commented Aug 15, 2020

+1 umi 3.2.15

@williamnie
Copy link
Contributor

windows的问题,暂时需要等官方来解决一下

@StArRy5211
Copy link

+1 求官方解决

@williamnie
Copy link
Contributor

+1 求官方解决

windows系统上报错么?

@StArRy5211
Copy link

是的 mac上面是正常的

@xiaohuoni
Copy link
Member

@ycjcl868 看评论是 windows 系统上特有的问题?

@StArRy5211
Copy link

@ycjcl868 看评论是 windows 系统上特有的问题?

是的 windows 在编译umi的时候会抛该异常,mac上面运行正常

@StArRy5211
Copy link

有解决方案了吗

@ycjcl868
Copy link
Contributor

我找个 windows 试试

@a982564562
Copy link

config.assets = { publicPath: "/public/", devServer: { debug: true, command: "umi dev", port: 8000, env: { APP_ROOT: process.cwd() + "\\app\\web", // BROWSER: "none", // ESLINT: "none", SOCKET_SERVER: "http://127.0.0.1:8000" } } };
/app/web修改成\app\web umi.server.js能正常打包出来,但是运行报document is not defined

@StArRy5211
Copy link

这个有结果了吗?

@ycjcl868
Copy link
Contributor

这个有结果了吗?

https://github.com/umijs/umi/pull/5486/files#diff-754d395d0bf281da5b546b90bcd4da3fR18-R20

可能是 engines 的问题,试下这样改能不能运行

@StArRy5211
Copy link

还是一样

@zyy2008
Copy link

zyy2008 commented Apr 13, 2021

一样问题

@devsvc
Copy link

devsvc commented Jun 22, 2021

问题没有解决,怎么关掉了? 同样的问题,还是报错,但能运行出结果; 但是hot-reload没有,改一次要重启一次,还要删掉.umi文件夹才行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants