Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not resolve "mock-aws-s3" #73

Open
TheUncharted opened this issue Sep 4, 2023 · 2 comments
Open

Could not resolve "mock-aws-s3" #73

TheUncharted opened this issue Sep 4, 2023 · 2 comments

Comments

@TheUncharted
Copy link

TheUncharted commented Sep 4, 2023

Hello

I started a starter react project with vite and got thoses errors below
I wanted to test it quickly in a frontend with mapbox and then put the logic in the back

To reproduce

  • pnpm create vite radars2 --template react-ts
  • pnpm install @radarlabs/s2
  • change app.tsx
  • pnpm dev
import './App.css';

import viteLogo from '/vite.svg';
import { useState } from 'react';

import reactLogo from './assets/react.svg';

const s2 = require('@radarlabs/s2');

function App() {
  const [count, setCount] = useState(0);
  const s2LatLong = new s2.LatLng(32.715651, -117.160542);
  const cellCoveringOptions = { min: 6, max: 13, max_cells: 10 };
  const coveringCells = s2.RegionCoverer.getRadiusCovering(
    s2LatLong,
    10000,
    cellCoveringOptions
  );
  console.log(coveringCells.cellIds().map((cellId) => cellId.token()));
  return (
    <>
      <div>
        <a href="https://vitejs.dev" target="_blank">
          <img src={viteLogo} className="logo" alt="Vite logo" />
        </a>
        <a href="https://react.dev" target="_blank">
          <img src={reactLogo} className="logo react" alt="React logo" />
        </a>
      </div>
      <h1>Vite + React</h1>
      <div className="card">
        <button onClick={() => setCount((count) => count + 1)}>
          count is {count}
        </button>
        <p>
          Edit <code>src/App.tsx</code> and save to test HMR
        </p>
      </div>
      <p className="read-the-docs">
        Click on the Vite and React logos to learn more
      </p>
    </>
  );
}

export default App;
[ERROR] Could not resolve "mock-aws-s3"

    node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:43:28:
      43 │     const AWSMock = require('mock-aws-s3');
         ╵                             ~~~~~~~~~~~~~

  You can mark the path "mock-aws-s3" as external to exclude it from the bundle, which will remove
  this error. You can also surround this "require" call with a try/catch block to handle this
  failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "aws-sdk"

    node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:76:22:
      76 │   const AWS = require('aws-sdk');
         ╵                       ~~~~~~~~~

  You can mark the path "aws-sdk" as external to exclude it from the bundle, which will remove this
  error. You can also surround this "require" call with a try/catch block to handle this failure at
  run-time instead of bundle-time.

✘ [ERROR] Could not resolve "nock"

    node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:112:23:
      112 │   const nock = require('nock');
          ╵                        ~~~~~~

  You can mark the path "nock" as external to exclude it from the bundle, which will remove this
  error. You can also surround this "require" call with a try/catch block to handle this failure at
  run-time instead of bundle-time.
@TheUncharted
Copy link
Author

adding the libs doe not generate the errors anymore but i got the following errors in the browser console

pnpm add @mapbox/node-pre-gyp@^1.0.10 aws-sdk@^2.1396.0 mock-aws-s3@^4.0.2 nock@^13.3.1

Uncaught ReferenceError: process is not defined at module2.exports.get_mockS3Http (s3_setup.js:108:3) at node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js (node-pre-gyp.js:15:49) at __require2 (chunk-6NOISVLF.js?v=fa4056a4:16:50) at node_modules/@radarlabs/s2/index.js (index.js:2:16) at __require2 (chunk-6NOISVLF.js?v=fa4056a4:16:50) at index.js:6:18

@tmcscoobydoo
Copy link

i'm getting the same error when i deploy my sveltekit website ,any idea how to remove it please ? , my problem is i don't have any line that importing mock-aws-s3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants