簡體   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