Shopify / shopify-api-js

Shopify Admin API Library for Node. Accelerate development with support for authentication, graphql proxy, webhooks
MIT License
944 stars 390 forks source link

Compiler Error: Number of modules not found when import '@shopify/shopify-api' #559

Closed yinghechen closed 2 years ago

yinghechen commented 2 years ago

Issue summary

I receive "./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js Module not found: Can't resolve 'aws-sdk' in '/home/ubuntu/node_modules/@mapbox/node-pre-gyp/lib/util'"

Write a short description of the issue here ↓ import Shopify from '@shopify/shopify-api'; gives me module not found error

package.json { "version": "0.1.0", "dependencies": { "@apollo/client": "^3.6.9", "@bigdatacloudapi/client": "^1.1.1", "@emotion/react": "^11.10.4", "@emotion/styled": "^11.10.4", "@mui/icons-material": "^5.10.3", "@mui/material": "^5.10.5", "@mui/x-data-grid": "^5.17.2", "@shopify/shopify-api": "^5.2.0", "aliexpress-product-scraper": "^1.0.6", "apollo-server": "^3.10.2", "axios": "^0.27.2", "datasource-sql": "^2.0.1", "deployment": "^0.2.3", "express": "^4.18.1", "graphql": "^16.6.0", "graphql-hooks": "^5.11.4", "graphql-js-client": "^0.12.0", "koa": "^2.13.4", "mysql": "^2.18.1", "mysql2": "^2.3.3", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.4.0", "react-scripts": "^2.1.3", "react-session-api": "^1.1.0", "sequelize": "^6.23.2", "util": "^0.12.4", "uuidv4": "^6.2.13", "web-vitals": "^2.1.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "description": "Hff Products Search Tool.", "main": "index.js", "keywords": [], "author": "", "license": "ISC", "type": "module" }

Expected behavior

Expect no compiler error

What do you think should happen? Some error that triggers to run @mapbox

Actual behavior

What actually happens?

Tip: include an error message (in a <details></details> tag) if your issue is related to an error

Steps to reproduce the problem

  1. create a new npm project
  2. add my package.json
  3. import Shopify from '@shopify/shopify-api' gives the error

Reduced test case

The best way to get your bug fixed is to provide a reduced test case.


Checklist

yinghechen commented 2 years ago

OK, the solution is to not using it in React(frontend)but in node.js(backend).