strapi-community / strapi-plugin-slugify

A plugin for Strapi Headless CMS that provides the ability to auto slugify a field for any content type.

Home Page:https://market.strapi.io/plugins/strapi-plugin-slugify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The "path" argument must be of type string. Received undefined

Drillan767 opened this issue · comments

Hello,
I've been trying to setup the plugin, and it keeps failinf when running yarn develop

I'm using Yarn version 4.1.3, and have Node 16.14.0

Here is how I set up the configuration:

slugify: {
  enabled: true,
  config: {
    contentTypes: {
      article: {
        field: 'slug',
        references: 'title',
      },
    },
  },
},

I also installed graphql, and tried to set the configuration before and after gql's configuration, but in vain.

I get the following error:

[2022-03-15 19:41:03.263] debug: ⛔️ Server wasn't able to start properly.
[2022-03-15 19:41:03.264] error: The "path" argument must be of type string. Received undefined
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:120:11)
    at join (node:path:1172:7)
    at Object.loadPlugins (/Users/joseph/DEV/overlord/api/node_modules/@strapi/strapi/lib/core/loaders/plugins/index.js:89:34)
    at async Strapi.loadPlugins (/Users/joseph/DEV/overlord/api/node_modules/@strapi/strapi/lib/Strapi.js:277:5)
    at async Promise.all (index 1)
    at async Strapi.register (/Users/joseph/DEV/overlord/api/node_modules/@strapi/strapi/lib/Strapi.js:309:5)
    at async Strapi.load (/Users/joseph/DEV/overlord/api/node_modules/@strapi/strapi/lib/Strapi.js:407:5)
    at async Strapi.start (/Users/joseph/DEV/overlord/api/node_modules/@strapi/strapi/lib/Strapi.js:161:9)
error Command failed with exit code 1.

I don't really know what I should do, if I need to delete my content type or if the error is from somewhere else?

Thank you in advance

Hi @Drillan767 thanks for the report, unfortunately I am unable to reproduce this issue. Do you have some repo that I can have a look at?

Hello, sorry for the delay, the project wassn't in a repo yet

Here is the repo, I even tried on another computer to check if I had more luck, but nothing.

Just run yarn develop if you want to see the error by yourself

Per the package.json the plugin has not been installed in the project

 "dependencies": {
    "@strapi/plugin-graphql": "^4.1.3",
    "@strapi/plugin-i18n": "4.1.3",
    "@strapi/plugin-seo": "^1.7.2",
    "@strapi/plugin-users-permissions": "4.1.3",
    "@strapi/strapi": "4.1.3",
    "mysql": "2.18.1",
    "strapi-plugin-comments": "^2.0.10"
  },

this is the cause of the issue. Running an yarn add strapi-plugin-slugify fixes this issue.

I feel like a HUGE idiot. Thanks a bunch 🥲

for mine it was node_modules volume cache, after I delete old node_modules volume it starts working

The issue is because the plugin wasn't installed but you had left the plugin config in your ./config/plugins.js so Strapi was trying to load a plugin that no longer was installed.