strapi-community / strapi-plugin-slugify

A plugin for Strapi Headless CMS that provides the ability to auto slugify a field for any content type.
https://market.strapi.io/plugins/strapi-plugin-slugify
MIT License
45 stars 21 forks source link

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

Closed Drillan767 closed 2 years ago

Drillan767 commented 2 years ago

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

ComfortablyCoding commented 2 years ago

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?

Drillan767 commented 2 years ago

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

ComfortablyCoding commented 2 years ago

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"
  },

Running an yarn add strapi-plugin-slugify fixes this issue.

Drillan767 commented 2 years ago

I feel like a HUGE idiot. Thanks a bunch 🥲

javadbat commented 2 years ago

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

derrickmehaffy commented 1 year ago

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.

dev-prathap commented 3 months ago

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined │ │ at __node_internal_captureLargerStackTrace (node:internal/errors:496:5) │ │ at new NodeError (node:internal/errors:405:5) │ │ at validateString (node:internal/validators:162:11) │ │ at Object.join (node:path:429:7) │ │ at D:\Backend\strapi\node_modules\@strapi\core\dist\loaders\components.js:17:31 │ │ at Array.forEach () │ │ at D:\Backend\strapi\node_modules\@strapi\core\dist\loaders\components.js:14:32 │ │ at Array.reduce () │ │ at loadComponents (D:\Backend\strapi\node_modules\@strapi\core\dist\loaders\components.js:13:39) │ │ at async Promise.all (index 5) │ │ at async Module.loadApplicationContext (D:\Backend\strapi\node_modules\@strapi\core\dist\loaders\index.js:12:3) │ │ at async Object.register (D:\Backend\strapi\node_modules\@strapi\core\dist\providers\registries.js:26:5) │ │ at async Strapi.register (D:\Backend\strapi\node_modules\@strapi\core\dist\Strapi.js:322:7) │ │ at async Strapi.load (D:\Backend\strapi\node_modules\@strapi\core\dist\Strapi.js:314:5) │ │ at async Module.develop (D:\Backend\strapi\node_modules\@strapi\strapi\dist\node\develop.js:177:28) │ │ at async action (D:\Backend\strapi\node_modules\@strapi\strapi\dist\cli\commands\develop.js:18:5) │ │ at async Command.parseAsync (D:\Backend\strapi\node_modules\commander\lib\command.js:923:5) │ │ at async runCLI (D:\Backend\strapi\node_modules\@strapi\strapi\dist\cli\index.js:75:3)