AWS amplify react - 无法启动项目
AWS amplify react - can't start the project
我已经安装了 aws-amplify 和 aws-amplify-react 软件包,这是我的 index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import Amplify from 'aws-amplify';
import aws_exports from './aws-exports';
Amplify.configure(aws_exports);
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
当我尝试启动应用程序时出现此错误:
ERROR in ./node_modules/graphql/index.mjs 64:0-98:42
Module not found: Error: Can't resolve './utilities' in 'C:\Users\PC5\Desktop\WebVezbanje\blog-kurs\node_modules\graphql'
Did you mean 'index.mjs'?
BREAKING CHANGE: The request './utilities' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
amplify 似乎不喜欢 react-scripts@5.0.0 中包含的 webpack 5
您应该尝试 Amplify 版本 4.3.11
及更高版本,即使用 graphql
15.8.0 与 Webpack 5
一起使用
除了 Francisco 更新软件包的建议外,
您还应该卸载 aws-amplify-react
包以支持新的 Amplify UI 库。该遗留包的对等依赖项被锁定到旧版本的范围包将导致不需要的行为。
您可以通过 运行 npm i @aws-amplify/ui-react
安装新的 ui 组件
这里有一个 link 到新的 Amplify UI 文档以供参考:
https://ui.docs.amplify.aws/
aws-amplify-react 已弃用,因此如果您遇到此问题,只需卸载 aws-amplify-react 并安装@aws-amplify/ui-react。它对我有用
我已经安装了 aws-amplify 和 aws-amplify-react 软件包,这是我的 index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import Amplify from 'aws-amplify';
import aws_exports from './aws-exports';
Amplify.configure(aws_exports);
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
当我尝试启动应用程序时出现此错误:
ERROR in ./node_modules/graphql/index.mjs 64:0-98:42
Module not found: Error: Can't resolve './utilities' in 'C:\Users\PC5\Desktop\WebVezbanje\blog-kurs\node_modules\graphql'
Did you mean 'index.mjs'?
BREAKING CHANGE: The request './utilities' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
amplify 似乎不喜欢 react-scripts@5.0.0 中包含的 webpack 5
您应该尝试 Amplify 版本 4.3.11
及更高版本,即使用 graphql
15.8.0 与 Webpack 5
除了 Francisco 更新软件包的建议外,
您还应该卸载 aws-amplify-react
包以支持新的 Amplify UI 库。该遗留包的对等依赖项被锁定到旧版本的范围包将导致不需要的行为。
您可以通过 运行 npm i @aws-amplify/ui-react
这里有一个 link 到新的 Amplify UI 文档以供参考: https://ui.docs.amplify.aws/
aws-amplify-react 已弃用,因此如果您遇到此问题,只需卸载 aws-amplify-react 并安装@aws-amplify/ui-react。它对我有用