tencentcloudbase / cloudbase-cli Goto Github PK
View Code? Open in Web Editor NEWThe cli tool for cloudbase
License: ISC License
The cli tool for cloudbase
License: ISC License
这一行调用了checkFullAccess
而不是checkReadable
,为什么?
系统:win10
node: 14.18.1
报错详情:
npm ERR! code EEXIST
npm ERR! path D:\nodejs1418\node-v14.18.1-win-x64\node_modules@cloudbase\cli\node_modules@cloudbase\framework-core\node_modules@cloudbase\toolbox\node_modules.bin\nanoid.ps1
npm ERR! Refusing to delete D:\nodejs1418\node-v14.18.1-win-x64\node_modules@cloudbase\cli\node_modules@cloudbase\framework-core\node_modules@cloudbase\toolbox\node_modules.bin\nanoid.ps1: ../../../../_nanoid@3.3.4@nanoid/bin/nanoid.cjs symlink target is not controlled by npm D:\nodejs1418\node-v14.18.1-win-x64\node_modules@cloudbase\cli\node_modules@cloudbase\framework-core\node_modules@cloudbase\toolbox\node_modules\nanoid
npm ERR! File exists: D:\nodejs1418\node-v14.18.1-win-x64\node_modules@cloudbase\cli\node_modules@cloudbase\framework-core\node_modules@cloudbase\toolbox\node_modules.bin\nanoid.ps1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\rfeng\AppData\Roaming\npm-cache_logs\2022-09-14T04_58_04_962Z-debug.log
盼回复~
Microsoft Windous[版本6.1.7601]
版权所有(c)2009 Microsoft Corporation。保留所有权利。
npm安装提示:
C:\ Users\ tmp249>npm i-g acloudbase/cli
npm WARN deprecated requeste2.88.2: request has been deprecated, see https://git hub. com/request/request/issues/3142
D:\ Program Files\ node js\ node_global\ tcb ->D:\ Program Files\ node js\ node_global\n ode_modules@ cloudbase\ cli\ bin\ tcb. js
D:\ Program Files\ node js\ node_global\ cloudbase->D:\ Program Files\ node js\ node_9l obal\ node_modules\ Qcloudbase\ cli\ bin\ cloudbase. js
npm WARN ws07.3.0 requires a peer of bufferutila4.0.1 but none is installed. Yo u must install peer dependencies yourself.
npm WARN ws07.3.0 requires a peer of utf-8-validatee"5.0.2 but none is installed You must install peer dependencies yourself.
+acloudbase/cli0.7.4
added 392 packages in 300.742s
yarn安装提示:
C:\Users\tmp249>yarn global add acloudbase/cli yarn 9lobal u1.22.4
[1/4]Resoluing packages..
[2/4]Fetching packages...
[3/4]Linking dependencies...
[4/4]Building fresh packages...
success Installed"dcloudbase/cli80.7.4"with binaries:
-tcb
-cloudbase
Done in 3.77s.
查询版本提示:
C:\Users\tmp249>cloudbase-u cloudbase不是内部或外部命令,也不是可运行的程序或批处理文件。
好的不说了,TCB给我们带来很多的方便与可能,真是感觉 眼前一亮。
用了一个多月的TCB,针对CLI 和 framework
感觉包很大,装了很多东西,而且装的时间很长,而且有很多警告。。
这个safer-buffer 半天也装不下来,
作为一个nodejs 应用开发者,经常装各种依赖和库,对我们来说包越小越好,越快越好。纯属个人使用感受。
900多秒才装完。
问题
当有多个云账号时,每次部署都要切换账号很麻烦。
由于小程序注册一个给一个云账户,多账户特别普遍。
案例
假如我用有2个腾讯云账户,静态网站账户A,常用云账户B。
偶尔部署博客网站时,会触发以下场景:
tcb logout // 登出 常用云账户B
tcb login // 登录 静态网站账户A
拿手机扫码
tcb deploy xxx //部署网站
tcb logout //登出 静态网站账户A
tcb login // 登录 常用云账户B
拿手机扫码
继续在账户B进行日常开发
这种操作特别麻烦,希望提供一种方式免登录。
期望
在不注销当前账户B的情况下,直接部署到账户A。
例如 在项目A 工程放入.env 文件存入腾讯云账户密钥,直接可以部署。项目B还是默认使用当前tcb的登录信息
使用 tcb new 选择 "React 应用"
npm install
npm start
启动应用后是白屏, 是template有问题还是什么
14:25:16 + tcb hosting deploy -r gz
14:25:16 CloudBase CLI 1.12.0
14:25:16 CloudBase Framework 1.9.0
14:25:19 - 数据加载中...
14:25:19 - 准备上传中...
14:25:20
14:25:20 ✔
可以看得出来,现在准备需要3s以上,有点太慢了
我们现在有个瓶颈就卡在这,总的耗时才7s多
tcb --help
只会显示下面的内容,需要 tcb -h
才能正常显示支持的命令,两者表现不应该一样吗
选项:
--help 显示帮助信息 [布尔]
--version 显示版本号 [布尔]
tcb -h:
CloudBase CLI 1.7.0
CloudBase Framework 1.7.4
命令
login [options] 登录腾讯云账号
logout 登出腾讯云账号
env [cmd] 环境管理操作
fn [cmd] 操作函数
framework [cmd] 云开发 Serverless 应用框架操作
hosting [cmd] 静态托管资源管理操作
new [appName] [template] 创建新的云开发应用
open [link] 在浏览器中打开云开发相关连接
storage [cmd] 云存储资源管理操作
service [cmd] HTTP 访问服务管理操作
选项
--verbose 打印出内部运行信息
-r, --region <region> 指定环境地域
--mode <mode> 指定加载 env 文件的环境
--config-file <path> 指定配置文件路径
-v, --version 输出当前版本
-h, --help 查看命令帮助信息
Tips:
– 登录
$ tcb login
– 创建新的云开发应用
$ tcb new appName
– 部署云函数
$ tcb fn deploy
– 查看命令使用介绍
$ tcb fn -h
tcb -v
结果:
CloudBase CLI 2.1.6
CloudBase Framework 1.9.6
CLI: 2.1.6
Framework: 1.9.6
运行:tcb functions:layer:list
提示:functions:layer:list 不是有效的命令
在远程机器上(通过SSH连接),使用 tcb login
登录,卡在
✔ 已打开云开发 CLI 授权页面,请在云开发 CLI 授权页面同意授权
⠏ 获取授权中...
请支持这种场景下拉起授权网页,或提供授权网页连接供手动打开
如下命令,上传层,结果上传到了云函数下。云开发无法使用。
# tcb fn layer create test-sdk --file ./test-sdk -e xxxx
CloudBase CLI 2.2.8
CloudBase Framework 1.9.6
✔ 文件层创建成功!
CloudBase Framework info Version v1.5.0
CloudBase Framework info Github: https://github.com/Tencent/cloudbase-framework
CloudBase Framework info EnvId portal-2g7z6g94dd8f7b22
CloudBase Framework info Validate config file success.
CloudBase Framework info AppName vue
CloudBase Framework info ◆ install plugins
CloudBase Framework info callHooks 'preDeploy'
CloudBase Framework info ◆ init: client...
CloudBase Framework info Website 插件会自动开启静态网页托管能力,需要当前环境为 [按量计费] 模式
CloudBase Framework info Website 插件会部署应用资源到当前静态托管的 /vue 目录下
CloudBase Framework info ◆ init: server...
CloudBase Framework info ◆ init: auth...
CloudBase Framework info ◆ build: client...
CloudBase Framework info npm install --prefer-offline --no-audit --progress=false
CloudBase Framework info ◆ build: server...
CloudBase Framework info ◆ build: auth...
CloudBase Framework info npm run build
CloudBase Framework info ◆ compile: client...
CloudBase Framework info ◆ compile: server...
CloudBase Framework info ◆ compile: auth...
CloudBase Framework info callHooks 'postCompile'
CloudBase Framework error ENOENT: no such file or directory, open 'C:\Users\admin\cloudbase-framework\logs\Fri Dec 25 2020 16:41:09 GMT+0800 (**标准时间).log'
Error: ENOENT: no such file or directory, open 'C:\Users\admin\cloudbase-framework\logs\Fri Dec 25 2020 16:41:09 GMT+0800 (**标准时间).log'
× ENOENT: no such file or directory, open 'C:\Users\admin\cloudbase-framework\logs\Fri Dec 25 2020 16:41:09 GMT+0800 (**标准时间).log'
CloudBase CLI 2.3.11
CloudBase Framework 1.9.7
Weda 0.20.5
(node:2800) [DEP0040] DeprecationWarning: The punycode
module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ...
to show where the warning was created)
安装CLI后运行任何命令都会出现这个Bug,是CLI使用punycode的模块即将被启用吗
1、希望能够在创建层的时候允许指定运行环境,而不是一次性把PHP、Nodejs都加上。
2、在进行函数绑定的时候希望能够通过参数指定所选的层和版本,例如--layer xxx@latest。这样就对应xx层的最新版。
3、希望能够一次绑定多个函数。
node版本是16.14,npm是8.5
npm安装:
npm WARN deprecated [email protected]: The functionality that this package provided is now in @npmcli/arborist
npm WARN deprecated [email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
changed 2241 packages in 1m
yarn安装:
yarn global v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["util@^0.12.4"] is trying to unpack in the same destination "C:\\Users\\24051\\AppData\\Local\\Yarn\\Cache\\v6\\npm-node-util-polyfill-0.12.5-5f17a6059b73db61a875668781a1c2b136bd6fbc-integrity\\node_modules\\node-util-polyfill" as pattern ["node-util-polyfill@npm:util@^0.12.5"]. This could result in non-deterministic behavior, skipping.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @swc/[email protected]: The platform "win32" is incompatible with this module.
info "@swc/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @swc/[email protected]: The CPU architecture "x64" is incompatible with this module.
info @swc/[email protected]: The platform "win32" is incompatible with this module.
info "@swc/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @swc/[email protected]: The platform "win32" is incompatible with this module.
info "@swc/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @swc/[email protected]: The CPU architecture "x64" is incompatible with this module.
info @swc/[email protected]: The platform "win32" is incompatible with this module.
info "@swc/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @swc/[email protected]: The CPU architecture "x64" is incompatible with this module.
info @swc/[email protected]: The platform "win32" is incompatible with this module.
info "@swc/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @swc/[email protected]: The CPU architecture "x64" is incompatible with this module.
info @swc/[email protected]: The platform "win32" is incompatible with this module.
info "@swc/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @swc/[email protected]: The platform "win32" is incompatible with this module.
info "@swc/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @swc/[email protected]: The CPU architecture "x64" is incompatible with this module.
info "@swc/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info @swc/[email protected]: The CPU architecture "x64" is incompatible with this module.
info "@swc/[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@cloudbase/cli > @cloudbase/lowcode-cli > @cloudbase/lowcode-builder > @cloudbase/lowcode-generator > @cloudbase/[email protected]" has unmet peer dependency "@tcwd/[email protected]".
warning "@cloudbase/cli > @cloudbase/lowcode-cli > @cloudbase/lowcode-builder > @cloudbase/lowcode-generator > @cloudbase/[email protected]" has unmet peer dependency "@zxing/library@^0.18.6".
warning "@cloudbase/cli > @cloudbase/lowcode-cli > @cloudbase/lowcode-builder > @cloudbase/lowcode-generator > @cloudbase/[email protected]" has unmet peer dependency "lodash-es@^4.17.19".
warning "@cloudbase/cli > @cloudbase/lowcode-cli > @cloudbase/lowcode-builder > @cloudbase/lowcode-generator > @formily/[email protected]" has unmet peer dependency "@types/react@^16.8.23".
warning "@cloudbase/cli > @cloudbase/lowcode-cli > @cloudbase/lowcode-builder > @cloudbase/lowcode-generator > @formily/react-schema-renderer > @formily/[email protected]" has unmet peer dependency "scheduler@>=0.11.2".
warning "@cloudbase/cli > @cloudbase/lowcode-cli > @cloudbase/lowcode-builder > @cloudbase/lowcode-generator > @formily/react-schema-renderer > @formily/[email protected]" has unmet
peer dependency "@types/react@^16.8.23".
[4/4] Building fresh packages...
success Installed "@cloudbase/[email protected]" with binaries:
- tcb
- cloudbase
Done in 19.07s.
但是执行cloudbase -h:
λ cloudbase -h
bash: cloudbase: command not found
执行tcb -v:
λ tcb -v
bash: tcb: command not found
管理者开启终端安装结果同上。
这个命令看起来底层跑了一个webpack 那么有办法能修改这个webpack的配置嘛
想在ci 里automate 云函数同步上传。
但是functions.code.update 不会安装node dependencies 反而替换掉了原有的node_modules。
functions.deploy 也不能用 会报错部署失败函数已存在
希望这个method 或者有个method 可以和小程序里的 “上传并部署:云端安装依赖”一样 上传所有code 并云端安装依赖
好的不说了,TCB给我们带来很多的方便与可能,真是感觉 眼前一亮。
用了一个多月的TCB,针对CLI 和 framework
感觉包很大,装了很多东西,而且装的时间很长,而且有很多警告。。
这个safer-buffer 半天也装不下来,
作为一个nodejs 应用开发者,经常装各种依赖和库,对我们来说包越小越好,越快越好。纯属个人使用感受。
900多秒才装完。
当上传超过1000个文件的时候,命令行会一直显示等待状态:
没有任何反应。
ora.js 和 inquirer.js 对命令行的操作发生了冲突
cloudbase-cli/src/commands/hosting/hosting.ts
Lines 62 to 84 in 29fd204
We met a new error when installing the latest npm package, detailed logs:
$ yarn add @cloudbase/[email protected]
yarn add v1.22.19
info No lockfile found.
[1/4] 🔍 Resolving packages...
warning @cloudbase/cli > @cloudbase/manager-node > cos-nodejs-sdk-v5 > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning @cloudbase/cli > @cloudbase/lowcode-cli > @cloudbase/lowcode-deployer > cos-nodejs-sdk-v5 > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning @cloudbase/cli > @cloudbase/lowcode-cli > webpack-dev-server-3 > [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
warning @cloudbase/cli > @cloudbase/lowcode-cli > @cloudbase/lowcode-deployer > miniprogram-ci > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning @cloudbase/cli > @cloudbase/lowcode-cli > webpack-dev-server-3 > chokidar > [email protected]: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
warning @cloudbase/cli > @cloudbase/lowcode-cli > extract-loader > babel-runtime > [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
Couldn't find any versions for "@cloudbase/cals" that matches "^1.0.10"
? Please choose a version of "@cloudbase/cals" from this list: (Use arrow keys)
❯ 1.0.10-alpha.2
1.0.10-alpha.1
1.0.10-alpha.0
1.0.9
1.0.9-alpha.1
1.0.9-alpha.0
1.0.8
1.0.7
1.0.6
1.0.6-beta.1
I also tried some old versions, the same error exists.
调用没有报错,但是云函数没有部署成功。
在cloudstudio和本地win7旗舰版 环境下安装失败
现在 tcb login 失败了 exit code 仍是 0,在 ci 流程中无法依据返回码阻塞后续流程。
希望登录失败时 exit code 改为 -1。
可以参考 pgcli
或者 mycli
的方法设计
操作系统windows10
node版本v12.14.1
执行 npm i -g @cloudbase/cli 并为抛出任何错误
执行 cloudbase -v 报错如下
tcb : 无法加载文件 D:\nodejs\node_global\tcb.ps1。未对文件 D:\nodejs\node_global\tcb.ps1 进行数字签名。无法在当前系统上 运行该脚本。有关运行脚本和设置执行策略的详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execu tion_Policies。 所在位置 行:1 字符: 1 tcb login --key CategoryInfo : SecurityError: (:) [],PSSecurityException FullyQualifiedErrorId : UnauthorizedAccess
老版本
> tcb -v
0.9.4
升级
npm i -g @cloudbase/cli
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
C:\Users\xx\AppData\Roaming\npm\tcb -> C:\Users\xx\AppData\Roaming\npm\node_modules\@cloudbase\cli\bin\tcb.js
C:\Users\xx\AppData\Roaming\npm\cloudbase -> C:\Users\xx\AppData\Roaming\npm\node_modules\@cloudbase\cli\bin\cloudbase.js
> @cloudbase/[email protected] postinstall C:\Users\xx\AppData\Roaming\npm\node_modules\@cloudbase\cli
> node ./post-install.js || exit 0
了解如何使用 CloudBase CLI
请查看使用文档
https://docs.cloudbase.net/cli-v1/quick-start.html
+ @cloudbase/[email protected]
added 646 packages from 357 contributors, removed 2 packages, updated 66 packages and moved 5 packages in 86.613s
错误,这个错误导致cli完全无法使用。
> tcb -h
CloudBase CLI 1.5.2
CloudBase Framework 1.7.0
C:\Users\xx\AppData\Roaming\npm\node_modules\@cloudbase\cli\node_modules\http-cache-semantics\index.js:1
SyntaxError: Invalid or unexpected token
at Module._compile (internal/modules/cjs/loader.js:895:18)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (C:\Users\xx\AppData\Roaming\npm\node_modules\@cloudbase\cli\node_modules\cacheable-request\src\index.js:7:21)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (C:\Users\xx\AppData\Roaming\npm\node_modules\@cloudbase\cli\node_modules\got\source\request-as-event-emitter.js:8:26)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.