zhangyuang / ssr

A most advanced ssr framework support React17/React18/Vue2/Vue3 on Earth that implemented serverless-side render specification.
http://doc.ssr-fc.com/
MIT License
2.61k stars 284 forks source link

npm run deploy 出现info: { command: 'package', commandPath: [] },message: 'command package not found'报错 #230

Closed lyc-15243 closed 2 years ago

lyc-15243 commented 2 years ago

使用脚手架创建midway-vue-ssr项目,并未做任何更改,本地运行成功,部署到serverless时出现以下报错:

$ npm run deploy

> midway-vue-ssr@1.0.0 deploy
> ssr build && ssr deploy -V

✔ Client
  Compiled successfully in 3.35s

✔ Server
  Compiled successfully in 3.72s

Hash: dbcd8ea03a41cba005fb
Version: webpack 4.46.0
Time: 3725ms
Built at: 2022/07/24 21:32:18
         Asset      Size  Chunks             Chunk Names
Page.server.js  19.4 KiB       0  [emitted]  Page
Hash: 379367dde57cc38144ad
Version: webpack 4.46.0
Time: 3355ms
Built at: 2022/07/24 21:32:19
                                      Asset       Size  Chunks                                Chunk Names
                        asset-manifest.json  655 bytes          [emitted]
         static/css/Page.18a19313.chunk.css  874 bytes       1  [emitted] [immutable]         Page
    static/css/detail-id.bf0898b5.chunk.css   3.28 KiB       2  [emitted] [immutable]         detail-id
        static/css/index.d7bcb756.chunk.css   14.7 KiB       4  [emitted] [immutable]         index
           static/js/Page.74171aec.chunk.js   2.07 KiB       1  [emitted] [immutable]         Page
static/js/detail-id-fetch.464600db.chunk.js  752 bytes       3  [emitted] [immutable]         detail-id-fetch
      static/js/detail-id.4a20b33c.chunk.js   4.86 KiB       2  [emitted] [immutable]         detail-id
    static/js/index-fetch.4b24532e.chunk.js  708 bytes       5  [emitted] [immutable]         index-fetch
          static/js/index.62f9d76b.chunk.js   4.34 KiB       4  [emitted] [immutable]         index
         static/js/runtime~Page.97e97ace.js   3.36 KiB       6  [emitted] [immutable]         runtime~Page
         static/js/vendor.2d6d01ee.chunk.js    292 KiB       0  [emitted] [immutable]  [big]  vendor
   - Copy Complete
Build Complete!
 If you find some problems when deploy, see http://doc.ssr-fc.com/docs/features$faq#Serverless%20%E5%8F%91%E5%B8%83%E5%A4%B1%E8%B4%A5
[Verbose]  command & options {
  _: [ 'deploy' ],
  version: false,
  v: false,
  V: true,
  '$0': 'node_modules\\ssr\\cjs\\cli.js',
  npm: 'npm --registry=https://registry.npmmirror.com'
}
[Verbose] 544 +0.00s mw plugin [] 
[Verbose]  Plugin load list [ { mod: '@midwayjs/cli-plugin-faas', command: 'deploy' } ]
[ midway ] CLI plugin '@midwayjs/cli-plugin-faas' was not installed, and will be installed automatically
[Verbose] 544 +11.33s Current Provider undefined 
[Verbose] 544 +0.00s Core Load plugin FaaSPlugin 
[Verbose] 544 +0.01s FaaS Plugin load list deploy [
  { mod: '@midwayjs/fcli-plugin-package', name: 'PackagePlugin' },
  { mod: '@midwayjs/fcli-plugin-deploy', name: 'DeployPlugin' },
  {
    mod: '@midwayjs/fcli-plugin-fc',
    name: 'AliyunFCPlugin',
    platform: 'aliyun',
    command: [ 'deploy', 'package' ]
  }
]
[Verbose] 544 +0.08s Load FaaS Plugin Error Error: Cannot find module 'typescript'
Require stack:
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\fcli-plugin-package\dist\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli-plugin-faas\dist\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli\dist\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli\bin\cli.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\deploy.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr\cjs\cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\fcli-plugin-package\src\index.ts:26:1) 
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\@midwayjs\\fcli-plugin-package\\dist\\index.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\@midwayjs\\cli-plugin-faas\\dist\\index.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\@midwayjs\\cli\\dist\\index.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\@midwayjs\\cli\\bin\\cli.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\ssr-plugin-midway\\cjs\\deploy.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\ssr-plugin-midway\\cjs\\index.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\ssr\\cjs\\cli.js'
  ]
}
[Verbose] 544 +0.05s Load FaaS Plugin Error Error: Cannot find module 'typescript'
Require stack:
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\fcli-plugin-package\dist\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli-plugin-faas\dist\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli\dist\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli\bin\cli.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\deploy.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr\cjs\cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\fcli-plugin-package\src\index.ts:26:1) 
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\@midwayjs\\fcli-plugin-package\\dist\\index.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\@midwayjs\\cli-plugin-faas\\dist\\index.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\@midwayjs\\cli\\dist\\index.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\@midwayjs\\cli\\bin\\cli.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\ssr-plugin-midway\\cjs\\deploy.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\ssr-plugin-midway\\cjs\\index.js',
    'C:\\Users\\lyc10\\Desktop\\ssr\\example\\midway-vue-ssr\\node_modules\\ssr\\cjs\\cli.js'
  ]
}
[Verbose] 544 +0.01s Load FaaS Plugin Error Error: Cannot find module '@midwayjs/fcli-plugin-fc'
Require stack:
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli-plugin-faas\dist\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli\dist\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli\bin\cli.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\deploy.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\index.js
- C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr\cjs\cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at load (C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli-plugin-faas\src\index.ts:47:18)
    at getPluginClass (C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\command-core\src\plugin.ts:105:13)
    at FaaSPlugin.asyncInit (C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\cli-plugin-faas\src\index.ts:43:48)  
    at CommandCore.asyncInit (C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\@midwayjs\command-core\src\core.ts:524:24)    
  info: { command: 'package', commandPath: [] },
  message: 'command package not found'
}

Error! You can try adding the -V parameter for more information output.

{
  info: { command: 'package', commandPath: [] },
  message: 'command package not found'
}

当前使用的版本

midway-vue-ssr@1.0.0 C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr
├── @midwayjs/bootstrap@3.4.3
├── @midwayjs/core@3.4.3
├── @midwayjs/decorator@3.4.1
├── @midwayjs/koa@3.4.3
├── @midwayjs/mock@3.4.3
├── bindings@1.5.0 extraneous
├── cross-env@7.0.3
├── eslint-config-standard-vue-ts@1.0.21
├── koa-static-cache@5.1.4
├── midway-schedule@2.14.7
├── nan@2.16.0 extraneous
├── pm2@4.5.6
├── ssr-core-vue@6.2.12
├── ssr-plugin-midway@6.2.15
├── ssr-plugin-vue@6.2.33
├── ssr-server-utils@6.2.58
├── ssr-types@6.2.22
├── ssr@6.2.29
├── swiper@5.4.5
├── typescript@4.7.4
├── vue-awesome-swiper@4.1.1
├── vue-router@3.5.4
├── vue@2.7.8
└── vuex@3.6.2

本机环境
win11 + npm8.3.1+ nodev16.14.0

复现仓库地址

所用的代码皆为脚手架创建和仓库例子

你本人对问题可能的原因判断(如果你能大概判断的话)

我的感觉时本机环境问题,但是我无法判断。在第一次运行项目的时候正常,不会报错,部署阿里云时,正常,在需要AccountId的时候停止终端(想起我在阿里云还没开通云函数服务)。接下来重新安装依赖,执行上述步骤出现以上报错,我尝试过midway-vue-ssr,midway-vue3-ssr,以及仓库示例代码都不能成功。

zhangyuang commented 2 years ago

尝试换yarn重装依赖试试

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: lyc-15243 @.> 发送时间: 2022年7月24日 22:25 收件人: zhangyuang/ssr @.> 抄送: Subscribed @.***> 主题: Re: [zhangyuang/ssr] npm run deploy 出现info: { command: 'package', commandPath: [] },message: 'command package not found'报错 (Issue #230)

使用脚手架创建midway-vue-ssr项目,并未做任何更改,本地运行成功,部署到serverless时出现以下报错: $ npm run deploy > @. deploy > ssr build && ssr deploy -V ✔ Client Compiled successfully in 3.35s ✔ Server Compiled successfully in 3.72s Hash: dbcd8ea03a41cba005fb Version: webpack 4.46.0 Time: 3725ms Built at: 2022/07/24 21:32:18 Asset Size Chunks Chunk Names Page.server.js 19.4 KiB 0 [emitted] Page Hash: 379367dde57cc38144ad Version: webpack 4.46.0 Time: 3355ms Built at: 2022/07/24 21:32:19 Asset Size Chunks Chunk Names asset-manifest.json 655 bytes [emitted] static/css/Page.18a19313.chunk.css 874 bytes 1 [emitted] [immutable] Page static/css/detail-id.bf0898b5.chunk.css 3.28 KiB 2 [emitted] [immutable] detail-id static/css/index.d7bcb756.chunk.css 14.7 KiB 4 [emitted] [immutable] index static/js/Page.74171aec.chunk.js 2.07 KiB 1 [emitted] [immutable] Page static/js/detail-id-fetch.464600db.chunk.js 752 bytes 3 [emitted] [immutable] detail-id-fetch static/js/detail-id.4a20b33c.chunk.js 4.86 KiB 2 [emitted] [immutable] detail-id static/js/index-fetch.4b24532e.chunk.js 708 bytes 5 [emitted] [immutable] index-fetch static/js/index.62f9d76b.chunk.js 4.34 KiB 4 [emitted] [immutable] index static/js/runtime~Page.97e97ace.js 3.36 KiB 6 [emitted] [immutable] runtime~Page static/js/vendor.2d6d01ee.chunk.js 292 KiB 0 [emitted] [immutable] [big] vendor - Copy Complete Build Complete! If you find some problems when deploy, see http://doc.ssr-fc.com/docs/features$faq#Serverless%20%E5%8F%91%E5%B8%83%E5%A4%B1%E8%B4%A5 [Verbose] command & options { _: [ 'deploy' ], version: false, v: false, V: true, '$0': 'node_modules\ssr\cjs\cli.js', npm: 'npm --registry=https://registry.npmmirror.com' } [Verbose] 544 +0.00s mw plugin [] [Verbose] Plugin load list [ { mod: @./cli-plugin-faas', command: 'deploy' } ] [ midway ] CLI plugin @./cli-plugin-faas' was not installed, and will be installed automatically [Verbose] 544 +11.33s Current Provider undefined [Verbose] 544 +0.00s Core Load plugin FaaSPlugin [Verbose] 544 +0.01s FaaS Plugin load list deploy [ { mod: @./fcli-plugin-package', name: 'PackagePlugin' }, { mod: @./fcli-plugin-deploy', name: 'DeployPlugin' }, { mod: @./fcli-plugin-fc', name: 'AliyunFCPlugin', platform: 'aliyun', command: [ 'deploy', 'package' ] } ] [Verbose] 544 +0.08s Load FaaS Plugin Error Error: Cannot find module 'typescript' Require stack: - @.\fcli-plugin-package\dist\index.js - @.\cli-plugin-faas\dist\index.js - @.\cli\dist\index.js - @.\cli\bin\cli.js - C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\deploy.js - C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\index.js - C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr\cjs\cli.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> @.\fcli-plugin-package\src\index.ts:26:1) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) { code: 'MODULE_NOT_FOUND', requireStack: [ @.\fcli-plugin-package\dist\index.js', @.\cli-plugin-faas\dist\index.js', @.\cli\dist\index.js', @.\cli\bin\cli.js', 'C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\deploy.js', 'C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\index.js', 'C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr\cjs\cli.js' ] } [Verbose] 544 +0.05s Load FaaS Plugin Error Error: Cannot find module 'typescript' Require stack: - @.\fcli-plugin-package\dist\index.js - @.\cli-plugin-faas\dist\index.js - @.\cli\dist\index.js - @.\cli\bin\cli.js - C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\deploy.js - C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\index.js - C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr\cjs\cli.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> @.\fcli-plugin-package\src\index.ts:26:1) at Module._compile (node:internal/modules/cjs/loader:1103:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) { code: 'MODULE_NOT_FOUND', requireStack: [ @.\fcli-plugin-package\dist\index.js', @.\cli-plugin-faas\dist\index.js', @.\cli\dist\index.js', @.\cli\bin\cli.js', 'C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\deploy.js', 'C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\index.js', 'C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr\cjs\cli.js' ] } [Verbose] 544 +0.01s Load FaaS Plugin Error Error: Cannot find module @./fcli-plugin-fc' Require stack: - @.\cli-plugin-faas\dist\index.js - @.\cli\dist\index.js - @.\cli\bin\cli.js - C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\deploy.js - C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr-plugin-midway\cjs\index.js - C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr\node_modules\ssr\cjs\cli.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at load @.\cli-plugin-faas\src\index.ts:47:18) at getPluginClass @.\command-core\src\plugin.ts:105:13) at FaaSPlugin.asyncInit @.\cli-plugin-faas\src\index.ts:43:48) at CommandCore.asyncInit @.\command-core\src\core.ts:524:24) info: { command: 'package', commandPath: [] }, message: 'command package not found' } Error! You can try adding the -V parameter for more information output. { info: { command: 'package', commandPath: [] }, message: 'command package not found' }
当前使用的版本 @. C:\Users\lyc10\Desktop\ssr\example\midway-vue-ssr ├── @@. ├── @@. ├── @@. ├── @@. ├── @@. ├── @. extraneous ├── @. ├── @. ├── @. ├── @. ├── @. extraneous ├── @. ├── @. ├── @. ├── @. ├── @. ├── @. ├── @. ├── @. ├── @. ├── @. ├── @. ├── @. └── @.*** 本机环境 win11 + npm8.3.1+ nodev16.14.0
复现仓库地址

所用的代码皆为脚手架创建和仓库例子

你本人对问题可能的原因判断(如果你能大概判断的话)

我的感觉时本机环境问题,但是我无法判断。在第一次运行项目的时候正常,不会报错,部署阿里云时,正常,在需要AccountId的时候停止终端(想起我在阿里云还没开通云函数服务)。接下来重新安装依赖,执行上述步骤出现以上报错,我尝试过midway-vue-ssr,midway-vue3-ssr,以及仓库示例代码都不能成功。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

lyc-15243 commented 2 years ago

换yarn重装依赖,问题解决,非常感谢!