Tom Griffiths
Tom Griffiths

Reputation: 97

Strapi error after restarting server - "Error: Cannot find module 'strapi-utils'"

I was experiencing an issue in the strapi backend trying to use to content builder, so quit the server and went to restart and I got the following error:

Error: Cannot find module 'strapi-utils'
  Require stack:
  - /usr/local/lib/node_modules/strapi/bin/strapi.js
  at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
  at Function.Module._load (internal/modules/cjs/loader.js:690:27)
  at Module.require (internal/modules/cjs/loader.js:852:19)
  at require (internal/modules/cjs/helpers.js:74:18)
  at Object.<anonymous> (/usr/local/lib/node_modules/strapi/bin/strapi.js:13:17)
  at Module._compile (internal/modules/cjs/loader.js:959:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
  at Module.load (internal/modules/cjs/loader.js:815:32)
  at Function.Module._load (internal/modules/cjs/loader.js:727:14)
  at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/usr/local/lib/node_modules/strapi/bin/strapi.js' ]

I have tried reinstalling strapi-utils (npm i strapi-utils) but still throwing the error. What else can I try. Was working wonderfully up until this. Just does not want to restart now!!

Thanks in advance, Tom

Upvotes: 0

Views: 4837

Answers (1)

John Carney
John Carney

Reputation: 26

I can confirm this issue, working through the Strapi Deliveroo example.

yarn add strap-utils resolved it. Here's the package JSON, which includes the addition as well as the other packages I've had to add to get all modules the new versions of the platform working. There are other issues with the example, so some of these packages might not be directly related.

{
  "dependencies": 
  {
    "@apollo/react-hooks": "^3.1.5",
    "@apollo/react-ssr": "^3.1.5",
    "apollo-boost": "^0.4.9",
    "apollo-client": "^2.6.10",
    "bootstrap": "^4.5.0",
    "gql": "^1.1.2",
    "graphql": "^15.0.0",
    "next": "^9.4.0",
    "next-apollo": "^4.0.1",
    "react": "^16.13.1",
    "react-apollo": "^3.1.5",
    "react-dom": "^16.13.1",
    "reactstrap": "^8.4.1",
    "recompose": "^0.30.0",
    "strapi-utils": "^3.0.0-beta.20.3"
    },
    "scripts": 
    {
      "dev": "next",
      "build": "next build",
      "start": "next start"
    }
}

Upvotes: 1

Related Questions