Not sure why clicking Run causes "yarn add strapi" to run in console

I moved my strapi 4 project from /backend to the root. Before I moved, clicking the Run button showed nothing in the console. After I moved, clicking the Run button causes “yarn add strapi” to run in console. I’m not sure why this is happening, any ideas?

Adding strapi like that is how you add strapi 3 to a project, but I’m using strapi 4.

Here is my .replit file:

entrypoint = "strapi.js"

hidden = [".config", "package-lock.json"]

[interpreter]
command = [
    "prybar-nodejs",
    "-q",
    "--ps1",
    "\u0001\u001b[33m\u0002\u0001\u001b[00m\u0002 ",
    "-i"
]

[[hints]]
regex = "Error \\[ERR_REQUIRE_ESM\\]"
message = "We see that you are using require(...) inside your code. We currently do not support this syntax. Please use 'import' instead when using external modules. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)"

[nix]
channel = "stable-22_11"

[env]
XDG_CONFIG_HOME = "/home/runner/$REPL_SLUG/.config"
PATH = "/home/runner/$REPL_SLUG/.config/npm/node_global/bin:/home/runner/$REPL_SLUG/node_modules/.bin"
npm_config_prefix = "/home/runner/$REPL_SLUG/.config/npm/node_global"

[gitHubImport]
requiredFiles = [".replit", "replit.nix", ".config", "package.json", "package-lock.json"]

[packager]
language = "nodejs"

  [packager.features]
  packageSearch = true
  guessImports = true
  enabledForHosting = false

[unitTest]
language = "nodejs"

[debugger]
support = true

  [debugger.interactive]
  transport = "localhost:0"
  startCommand = [ "dap-node" ]

    [debugger.interactive.initializeMessage]
    command = "initialize"
    type = "request"

      [debugger.interactive.initializeMessage.arguments]
      clientID = "replit"
      clientName = "replit.com"
      columnsStartAt1 = true
      linesStartAt1 = true
      locale = "en-us"
      pathFormat = "path"
      supportsInvalidatedEvent = true
      supportsProgressReporting = true
      supportsRunInTerminalRequest = true
      supportsVariablePaging = true
      supportsVariableType = true

    [debugger.interactive.launchMessage]
    command = "launch"
    type = "request"
    
      [debugger.interactive.launchMessage.arguments]  
      args = []
      console = "externalTerminal"
      cwd = "."
      environment = []
      pauseForSourceMap = false
      program = "./index.js"
      request = "launch"
      sourceMaps = true
      stopOnEntry = false
      type = "pwa-node"

[languages]

[languages.javascript]
pattern = "**/{*.js,*.jsx,*.ts,*.tsx}"

[languages.javascript.languageServer]
start = "typescript-language-server --stdio"

[deployment]
run = ["yarn develop"]

Here is my replit.nix file:

{ pkgs }: {
	deps = [
		pkgs.nodejs-18_x
    	pkgs.nodePackages.typescript-language-server
    	pkgs.yarn
    	pkgs.replitPackages.jest
	];
}

And this is my package.json file:

{
  "name": "my-strapi-app",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "dependencies": {
    "@_sh/strapi-plugin-ckeditor": "^2.0.4",
    "@babel/runtime": "^7.21.0",
    "@codemirror/autocomplete": "^6.5.1",
    "@codemirror/language": "^6.6.0",
    "@codemirror/lint": "^6.2.1",
    "@codemirror/search": "^6.3.0",
    "@codemirror/state": "^6.2.0",
    "@codemirror/theme-one-dark": "^6.1.2",
    "@codemirror/view": "^6.9.5",
    "@lezer/common": "^1.0.2",
    "@microsoft/microsoft-graph-client": "^3.0.5",
    "@notum-cz/strapi-plugin-content-versioning": "^1.1.5",
    "@sklinet/strapi-plugin-video-field": "^1.0.5",
    "@strapi/design-system": "^1.7.9",
    "@strapi/icons": "^1.7.9",
    "@strapi/plugin-documentation": "^4.16.2",
    "@strapi/plugin-graphql": "^4.16.2",
    "@strapi/plugin-i18n": "4.16.2",
    "@strapi/plugin-users-permissions": "4.16.2",
    "@strapi/strapi": "^4.16.2",
    "@strapi/utils": "^4.16.2",
    "better-sqlite3": "8.0.1",
    "codemirror": "^6.0.1",
    "design-system": "strapi/design-system",
    "es6-promise": "^4.2.8",
    "husky": "^8.0.3",
    "isomorphic-fetch": "^3.0.0",
    "koa": "^2.14.2",
    "lodash": "^4.17.21",
    "node-fetch": "^3.3.1",
    "qs": "^6.11.2",
    "react": "^18.1.0",
    "react-dom": "^18.1.0",
    "react-is": "16.8.0",
    "react-router-dom": "5.3.4",
    "simple-oauth2": "^5.0.0",
    "slugify": "^1.6.6",
    "strapi-auto-uuid": "^0.0.7",
    "strapi-chatgpt": "^1.0.2",
    "strapi-content-type-explorer": "^0.1.1",
    "strapi-plugin-entity-relationship-chart": "jmather-aipm/strapi-plugin-entity-relationship-chart",
    "strapi-plugin-import-export-entries": "^1.19.2",
    "strapi-plugin-populate-deep": "^2.0.0",
    "strapi-plugin-schemas-to-ts": "^1.1.10",
    "strapi-plugin-timezone-select": "^1.0.0",
    "strapi-plugin-transformer": "^3.1.0",
    "styled-components": "5.3.3",
    "yup": "0.32.9"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "4bc8e67d-a6f9-4daa-900d-270bf8a472fd"
  },
  "engines": {
    "node": ">=14.19.1 <=18.x.x"
  },
  "license": "MIT",
  "devDependencies": {
    "@openapitools/openapi-generator-cli": "^2.7.0"
  }
}

Setting guessImports to false in the .replit file resolves this.

Now I’m not sure why ‘yarn develop’ isn’t running…

2 Likes

Something to do with the .replit file – I commented some stuff out and now my console shows strapi build and launch when i click play.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.