Closed duanzheng closed 3 years ago
本地验证了一下,打包是正常的,可以尝试升级 Node 版本或者重新安装 node_modules @duanzheng
本地验证了一下,打包是正常的,可以尝试升级 Node 版本或者重新安装 node_modules @duanzheng
还是会报错,但这次的报错是和 build 相关:
{ Error: Command failed: npm run build
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! midway-hooks-react-demo@1.0.0 build: `react-app-rewired build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the midway-hooks-react-demo@1.0.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/tony/.npm/_logs/2021-01-17T02_18_43_292Z-debug.log
at ChildProcess.exithandler (child_process.js:294:12)
at ChildProcess.emit (events.js:198:13)
at maybeClose (internal/child_process.js:982:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5) killed: false, code: 1, signal: null, cmd: 'npm run build' }
于是我单独执行了一下 npm run build
,报错如下:
> midway-hooks-react-demo@1.0.0 build /Users/tony/Documents/myCode/test-midway-3
> react-app-rewired build
Creating an optimized production build...
Failed to compile.
./src/apis/lambda/index.ts
Cannot find module: '@midwayjs/hooks/request'. Make sure this package is installed.
You can install this package by running: yarn add @midwayjs/hooks/request.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! midway-hooks-react-demo@1.0.0 build: `react-app-rewired build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the midway-hooks-react-demo@1.0.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/tony/.npm/_logs/2021-01-17T02_19_05_194Z-debug.log
复现步骤:
f create --template-package=@midwayjs-examples/midway-hooks-react
初始化项目;f deploy
或 npm run build
。我发现当 f.yml 中的 provider 配置为 tencent 和 aliyun 的时候会有不同的表现,不知道是否和这个相关。
btw,我的 node 版本是 v10.23.1,@midwayjs/faas-cli 的版本是 1.2.38
我今天也有这个错误,上上周是没问题
@duanzheng @jlala 升级 f cli 到最新版试试看, npm i @midwayjs/faas-cli@latest -g
项目是参考教程使用命令
f create --template-package=@midwayjs-examples/midway-hooks-react
创建的。 没有做任何改动,只修改了 f.yml 中的 Provider 配置为:执行
f deploy
时报错: