繁体   English   中英

./src/index.js 未找到模块:无法解析“aws-amplify”React

[英]./src/index.js Module not found: Can't resolve 'aws-amplify' React

我正在尝试学习 AWS 并做出反应。 当我使用“NPM start”在我的本地机器上运行它时,我的 React 应用程序不断收到以下错误。

./src/index.js 未找到模块:无法解析“C:\Users\pull-transactions\src”中的“aws-amplify”

在 Resolver.resolveModule (node_modules/jest-runtime/node_modules/jest-resolve/build/index.js:306:11) 在 Object。(src/components/PlaidLink.js:3:1)

index.js 配置:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import Amplify from 'aws-amplify';
import config from './aws-exports';
Amplify.configure(config);

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

我花了几个小时搜索谷歌,但找不到任何东西。 我有另一个运行良好的应用程序,两者的文件结构看起来相同。 任何帮助表示赞赏。 如果您需要更多信息,请告诉我。

您必须安装 package 才能使用它。

$ npm install # installs packages listed in your package.json file
$ npm install --save aws-amplify # installs the aws-amplify package and saves it to your package.json file

我正在尝试学习 AWS 并做出反应。 当我使用“NPM start”在本地机器上运行我的 react 应用程序时,我不断收到以下错误。

./src/index.js 未找到模块:无法解析“C:\Users\pull-transactions\src”中的“aws-amplify”

在 Object 的 Resolver.resolveModule (node_modules/jest-runtime/node_modules/jest-resolve/build/index.js:306:11)。 (src/components/PlaidLink.js:3:1)

index.js 配置:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import Amplify from 'aws-amplify';
import config from './aws-exports';
Amplify.configure(config);

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
);

我花了几个小时搜索谷歌,但找不到任何东西。 我有另一个运行良好的应用程序,并且两者的文件结构看起来相同。 任何帮助表示赞赏。 如果您需要更多信息,请告诉我。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM