2

I'm trying to get the repo of a web page running on localhost, to later try to update some of the outdated dependencies. This web page runs on Next JS with Strapi version 3. After Strapi version 4 went live, the team had trouble updating the content on the page. I wanted to try and see how I could help, but have trouble even running the website locally. I'm a beginner and would be happy to learn about any suggestions.

Here is the folder structure:

  • backend
    • api: config, controllers, models, services folders for Strapi
    • components: layout, links, meta, sections folders for Vue JS
    • config: database.js, server.js
    • extensions: Includes JSON Web Token integration
    • public: uploads folder with icons and images used on the website
    • Also the following files:
      • .editorconfig
      • .eslintrc
      • .strapi-updater.json
      • package.json
      • yarn.lock
  • frontend
    • components: elements and sections folders with React JS
    • packages: eslint-config-ibmdotcom & stylelint-config-ibmdotcom
    • pages: _app.js, _document.js and [[...slug]].js to implement Next JS' optional catch all routes feature
    • patches: carbon ibmdotcom, carbon type and patch package patches
    • public: A few icons to be used on the website
    • styles: Includes global.scss
    • utils: api.js, media.js and types.js
    • Also the following files:
      • .eslintrc
      • .lintstagedrc
      • .stylelintrc
      • jsconfig.json
      • package.json
      • yarn.lock
  • node_modules
  • patches
  • Also the following files:
    • .yarnclean
    • package-lock.json
    • package.json
    • yarn.lock

Here are the dependencies:

  • In frontend/package.json:

{
  "name": "frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --port 3200",
    "build": "next build",
    "start": "next start --port 3400",
    "postinstall": "patch-package",
    "debug": "NODE_OPTIONS='--inspect' next --port 3300"
  },
  "dependencies": {
    "@carbon/ibmdotcom-react": "^1.14.0",
    "@carbon/ibmdotcom-styles": "^1.14.0",
    "@carbon/icons-react": "^10.22.0",
    "@carbon/pictograms-react": "^11.0.0",
    "carbon-components-react": "^7.26.0",
    "formik": "^2.2.6",
    "next": "10.0.5",
    "next-seo": "^4.17.0",
    "patch-package": "^6.2.2",
    "postinstall-postinstall": "^2.1.0",
    "react": "17.0.1",
    "react-dom": "17.0.1",
    "react-hook-form": "^6.14.2",
    "sass": "^1.32.2",
    "yup": "^0.32.8"
  },
  "devDependencies": {
    "eslint": "^7.17.0"
  }
}
  • In backend/package.json:

{
  "name": "backend",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "devDependencies": {},
  "dependencies": {
    "knex": "<0.20.0",
    "pg": "^8.5.1",
    "sqlite3": "latest",
    "strapi": "3.4.3",
    "strapi-admin": "3.4.3",
    "strapi-connector-bookshelf": "3.4.3",
    "strapi-plugin-content-manager": "3.4.3",
    "strapi-plugin-content-type-builder": "3.4.3",
    "strapi-plugin-email": "3.4.3",
    "strapi-plugin-img": "^1.0.1",
    "strapi-plugin-upload": "3.4.3",
    "strapi-plugin-users-permissions": "3.4.3",
    "strapi-utils": "3.4.3"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "c78c2abc-df48-4be1-8dcf-1266d358a02b"
  },
  "engines": {
    "node": ">=10.16.0 <=14.x.x",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}

Here is what I tried so far:

  1. Ran npm install
  2. Got the following error:
> website@1.0.0 postinstall
> patch-package

sh: patch-package: command not found
npm ERR! code 127
npm ERR! path /Users/sgt/Documents/Stroma/website
npm ERR! command failed
npm ERR! command sh -c patch-package

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sgt/.npm/_logs/2022-09-02T09_46_38_695Z-debug-0.log

  1. Ran npm i patch-package
  2. Got the following error:

added 50 packages, and audited 68 packages in 5s

6 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
sgt@mb-sgt website % npm install              

> website@1.0.0 postinstall
> patch-package

patch-package 6.4.7
Applying patches...

**ERROR** Failed to apply patch for package patch-package at path
  
    node_modules/patch-package

  This error was caused because patch-package has changed since you
  made the patch file for it. This introduced conflicts with your patch,
  just like a merge conflict in Git when separate incompatible changes are
  made to the same piece of code.

  Maybe this means your patch file is no longer necessary, in which case
  hooray! Just delete it!

  Otherwise, you need to generate a new patch file.

  To generate a new one, just repeat the steps you made to generate the first
  one.

  i.e. manually make the appropriate file changes, then run 

    patch-package patch-package

  Info:
    Patch file: patches/patch-package+6.2.2.patch
    Patch was made for version: 6.2.2
    Installed version: 6.4.7

---
patch-package finished with 1 error(s).

up to date, audited 68 packages in 1s

6 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

  1. Ran npx patch-package patch-package --exclude 'nothing'
  2. Got the following error:
patch-package 6.4.7
patch-package: you have both yarn.lock and package-lock.json
Defaulting to using npm
You can override this setting by passing --use-yarn or deleting
package-lock.json if you don't need it

• Creating temporary folder
• Installing patch-package@6.4.7 with npm
• Diffing your files with clean files
⁉️  Not creating patch file for package 'patch-package'
⁉️  There don't appear to be any changes.

What is the problem here? Does my method seem correct?

Happy to provide more information. Thanks for reading!

apfelbaum
  • 21
  • 2

0 Answers0