cha*_*i86 1 amazon-web-services amazon-cognito aws-appsync aws-amplify
我在我的项目中使用 React Native。在我的旧机器上,当我运行 amplify status 时,我列出了Auth
和Api
服务Storage
。
我搬到我的新机器,安装了节点、watchman、brew 等...然后导航到我的 React Native 项目并运行:react-native run-ios
,瞧,我的应用程序正在运行。对我的 AWS Api、Auth 和 Storage 的所有调用都运行良好。
现在我可以发出一些放大命令。例如amplify status
。我试过:amplify env add
这就是我得到的:
Users-MBP-2:projectname username$ amplify env add\nNote: It is recommended to run this command from the root of your app directory\n? Do you want to use an existing environment? Yes\n? Choose the environment you would like to use: dev\nUsing default provider awscloudformation\n\xe2\x9c\x96 There was an error initializing your environment.\ninit failed\nError: ENOENT: no such file or directory, open '/Users/username/.aws/credentials'\n at Object.openSync (fs.js:462:3)\n at Proxy.readFileSync (fs.js:364:35)\n at Object.readFileSync (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/util.js:95:26)\n at IniLoader.parseFile (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/shared-ini/ini-loader.js:6:47)\n at IniLoader.loadFrom (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/shared-ini/ini-loader.js:56:30)\n at Config.region (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/node_loader.js:100:36)\n at Config.set (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/config.js:507:39)\n at Config.<anonymous> (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/config.js:342:12)\n at Config.each (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/util.js:507:32)\n at new Config (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/aws-sdk/lib/config.js:341:19) {\n errno: -2,\n syscall: 'open',\n code: 'ENOENT',\n path: '/Users/username/.aws/credentials'\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n您认为凭证信息需要带到/配置到我的新机器上吗?
\n\n当我跑步时amplify configure project
,就像做一个amplify init
从头开始构建一个项目。我被问到:
? Enter a name for the project: ProjectName\n? Choose your default editor: Visual Studio Code\n? Choose the type of app that you're building javascript\nPlease tell us about your project\n? What javascript framework are you using (Use arrow keys)\n angular \n ember \n ionic \n react \n\xe2\x9d\xaf react-native \n vue \n none \netc....\n
Run Code Online (Sandbox Code Playgroud)\n\n我也已经有了一个区域、用户名和 accessKey、secretAccess key 等。
\n\n我不想替换或破坏当前后端或当前项目中的任何内容!这是怎么回事?
\n npm install -g @aws-amplify/cli
amplify configure
Run Code Online (Sandbox Code Playgroud)
运行 amplify configure 主要是为了让 cli 了解您的 AWS 账户,以便后续命令可以访问内容。
如果出现amplify: command not found
错误,请尝试重新启动终端。如果仍然没有成功,您将需要检查 amplify 是否已添加到您的 PATH 变量中。
amplify env add
,但选择现有环境。这将允许您选择在其他计算机上创建的环境,以便您可以将这些设置拉到新计算机上。 amplify env add
? Do you want to use an existing environment? Yes
Production
Run Code Online (Sandbox Code Playgroud)
跟进:
amplify pull
Run Code Online (Sandbox Code Playgroud)
您不需要amplify add auth
再次运行或执行任何操作。完成上述操作后,所有这些都会自动下拉。
归档时间: |
|
查看次数: |
10187 次 |
最近记录: |