Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@vendure/cli scaffolding a new plugin does not work #2819

Closed
flobacher opened this issue Apr 29, 2024 · 5 comments
Closed

@vendure/cli scaffolding a new plugin does not work #2819

flobacher opened this issue Apr 29, 2024 · 5 comments
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@flobacher
Copy link

Describe the bug
Trying to scaffold a new plugin in a pristine vendure project with the CLI results in an error:

◒ Generating plugin scaffold│
■ Manipulation error: Maximum call stack size exceeded

│ -- Details --
│ Path: /my-shop/src/plugins/my-new-feature/my-new-feature.plugin.ts
│ Text: "import { PluginCommonModule, Type, VendurePlugin } from '@vendure/core';\r\n\r\nimport { MY_NEW_FEATURE_PLUGIN_OPTIONS } from './constants.template';\r\nimport { PluginInitOptions } from '../../my-shop/src/plugins/my-new-feature/types';\r\n\r\n@VendurePlugin({\r\n imports: [PluginCommonModule],\r\n providers: [{ provide: MY_NEW_FEATURE_PLUGIN_OPTIONS, useFactory: () => MyNewFeaturePlugin.options }],\r\n configuration: config => {\r\n // Plugin-specific configuration\r\n // such as custom fields, custom permissions,\r\n // strategies etc. can be configured here by\r\n // modifying the config object.\r\n return config;\r\n },\r\n compatibility: '^2.0.0',\r\n})\r\nexport class MyNewFeaturePlugin {\r\n static options: PluginInitOptions;\r\n\r\n static init(options: PluginInitOptions): Type {\r\n this.options = options;\r\n return MyNewFeaturePlugin;\r\n }\r\n}\r\n"
│ Stack: RangeError: Maximum call stack size exceeded
│ at parseMemberExpressionOrHigher (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32312:47)
│ at parseLeftHandSideExpressionOrHigher (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32308:88)
│ at parseUpdateExpression (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32283:30)
│ at parseUnaryExpressionOrHigher (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32202:38)
│ at parseBinaryExpressionOrHigher (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32124:31)
│ at parseAssignmentExpressionOrHigher (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:31795:24)
│ at /my-shop/node_modules/@ts-morph/common/dist/typescript.js:32984:50
│ at doOutsideOfContext (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:29426:18)
│ at allowInAnd (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:29447:18)
│ at parseObjectLiteralElement (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32984:33)

■ Error: Manipulation error: Maximum call stack size exceeded

│ -- Details --
│ Path: /my-shop/src/plugins/my-new-feature/my-new-feature.plugin.ts
│ Text: "import { PluginCommonModule, Type, VendurePlugin } from '@vendure/core';\r\n\r\nimport { MY_NEW_FEATURE_PLUGIN_OPTIONS } from './constants.template';\r\nimport { PluginInitOptions } from '../../my-shop/src/plugins/my-new-feature/types';\r\n\r\n@VendurePlugin({\r\n imports: [PluginCommonModule],\r\n providers: [{ provide: MY_NEW_FEATURE_PLUGIN_OPTIONS, useFactory: () => MyNewFeaturePlugin.options }],\r\n configuration: config => {\r\n // Plugin-specific configuration\r\n // such as custom fields, custom permissions,\r\n // strategies etc. can be configured here by\r\n // modifying the config object.\r\n return config;\r\n },\r\n compatibility: '^2.0.0',\r\n})\r\nexport class MyNewFeaturePlugin {\r\n static options: PluginInitOptions;\r\n\r\n static init(options: PluginInitOptions): Type {\r\n this.options = options;\r\n return MyNewFeaturePlugin;\r\n }\r\n}\r\n"
│ Stack: RangeError: Maximum call stack size exceeded
│ at parseMemberExpressionOrHigher (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32312:47)
│ at parseLeftHandSideExpressionOrHigher (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32308:88)
│ at parseUpdateExpression (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32283:30)
│ at parseUnaryExpressionOrHigher (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32202:38)
│ at parseBinaryExpressionOrHigher (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32124:31)
│ at parseAssignmentExpressionOrHigher (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:31795:24)
│ at /my-shop/node_modules/@ts-morph/common/dist/typescript.js:32984:50
│ at doOutsideOfContext (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:29426:18)
│ at allowInAnd (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:29447:18)
│ at parseObjectLiteralElement (/my-shop/node_modules/@ts-morph/common/dist/typescript.js:32984:33)
│ at throwError (/my-shop/node_modules/ts-morph/dist/ts-morph.js:2375:19)
│ at doManipulation (/my-shop/node_modules/ts-morph/dist/ts-morph.js:2373:9)
│ at replaceSourceFileForFilePathMove (/my-shop/node_modules/ts-morph/dist/ts-morph.js:2801:5)
│ at SourceFile._moveInternal (/my-shop/node_modules/ts-morph/dist/ts-morph.js:13424:9)
│ at SourceFile.move (/my-shop/node_modules/ts-morph/dist/ts-morph.js:13400:19)
│ at generatePlugin (/my-shop/node_modules/@vendure/cli/dist/commands/add/plugin/create-new-plugin.js:184:16)
│ at async Object.createNewPlugin [as run] (/my-shop/node_modules/@vendure/cli/dist/commands/add/plugin/create-new-plugin.js:90:54)
│ at async addCommand (/my-shop/node_modules/@vendure/cli/dist/commands/add/add.js:47:50)
│ at async Command. (/my-shop/node_modules/@vendure/cli/dist/cli.js:52:5)
│ at async Command.parseAsync (/my-shop/node_modules/@vendure/cli/node_modules/commander/lib/command.js:936:5)

└ ❌ Error

◇ Canceled
➜ my-shop

To Reproduce
Steps to reproduce the behavior:

  1. Create a new vendure project via npx @vendure/create my-shop
  2. Install the cli via npm i -D @vendure/cli
  3. Try to scaffold a new plugin via the cli npx vendure add select │ ● [Plugin] Create a new Vendure plugin
  4. See error

Expected behavior
Scaffold the folder-structure and files of a new plugin called my-new-feature

Environment (please complete the following information):

  • @vendure/core version: 2.2.2
  • Nodejs version: 20.11.0
  • npm version: 10.2.4
  • Database: sqlite
  • macOS 13.6.6

Additional context
Add any other context about the problem here.

@michaelbromley
Copy link
Member

Hi Flo,

Thanks for the report. This must be environment-specific. I just tried did:

  1. npx @vendure/create@2.2.2 vendure-222 and completed creation of new project
  2. (did not install @vendure/cli because it is now included as standard)
  3. npx vendure add and selected Plugin.

It worked as expected and created the new plugin without error.

This is on

Node: 20.9.0
npm: 10.2.3
os: Windows 11

If anyone else is able to reproduce on other environments please let me know what your env looks like.

@flobacher
Copy link
Author

Thx @michaelbromley for the quick reply.. just repeated your steps in a new folder without additional installation of the cli, the problem remained the same =/

@saoudi-h
Copy link
Contributor

Hello,

I would like to provide additional info regarding the "Maximum call stack size exceeded" error encountered when creating a new Vendure plugin on fresh installation (vendure 2.2.2)

In my Windows environment with Node.js version 20.11.1 and npm version 10.2.0, I did not encounter any issues. However, when using WSL (Ubuntu) on the same Windows machine and the same project, I was able to reproduce the reported error. To be sure, I deleted the node_modules folder and reinstalled all packages from WSL (in case the package installations are OS-specific), and the result was the same.

It seems that this issue may specifically relate to certain UNIX environments, such as Linux and macOS.

image

@hammadsanaullah
Copy link

hammadsanaullah commented Apr 30, 2024

The same issue happens with me as well, I am unable to create new plugin through the cli

My environment is:
Node: 20.9.0
NPM: 10.1.0
OS: MacOS

◒ Generating plugin scaffold│ ■ Manipulation error: Maximum call stack size exceeded │ │ -- Details -- │ Path: /alcosta-vendure/src/plugins/my-new-feature/my-new-feature.plugin.ts │ Text: "import { PluginCommonModule, Type, VendurePlugin } from '@vendure/core';\r\n\r\nimport { MY_NEW_FEATURE_PLUGIN_OPTIONS } from './constants.template';\r\nimport { PluginInitOptions } from '../../alcosta-vendure/src/plugins/my-new-feature/types';\r\n\r\n@VendurePlugin({\r\n imports: [PluginCommonModule],\r\n providers: [{ provide: MY_NEW_FEATURE_PLUGIN_OPTIONS, useFactory: () => MyNewFeaturePlugin.options }],\r\n configuration: config => {\r\n // Plugin-specific configuration\r\n // such as custom fields, custom permissions,\r\n // strategies etc. can be configured here by\r\n // modifying the configobject.\r\n return config;\r\n },\r\n compatibility: '^2.0.0',\r\n})\r\nexport class MyNewFeaturePlugin {\r\n static options: PluginInitOptions;\r\n\r\n static init(options: PluginInitOptions): Type<MyNewFeaturePlugin> {\r\n this.options = options;\r\n return MyNewFeaturePlugin;\r\n }\r\n}\r\n" │ Stack: RangeError: Maximum call stack size exceeded │ at Object.getCanonicalFileName (/alcosta-vendure/node_modules/@ts-morph/common/dist/ts-morph-common.js:1416:31) │ at getCanonicalFileName (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:121251:19) │ at toPath (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:6823:12) │ at Object.getPackageJsonInfo2 [as getPackageJsonInfo] (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:39877:49) │ at getPackageJsonInfo (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:40889:78) │ at loadModuleFromSpecificNodeModulesDirectory (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:41548:23) │ at loadModuleFromImmediateNodeModulesDirectory (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:41525:29) │ at /alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:41513:33 │ at forEachAncestorDirectory (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:6975:22) │ at lookup (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:41507:14) │ ■ Error: Manipulation error: Maximum call stack size exceeded │ │ -- Details -- │ Path: /alcosta-vendure/src/plugins/my-new-feature/my-new-feature.plugin.ts │ Text: "import { PluginCommonModule, Type, VendurePlugin } from '@vendure/core';\r\n\r\nimport { MY_NEW_FEATURE_PLUGIN_OPTIONS } from './constants.template';\r\nimport { PluginInitOptions } from '../../alcosta-vendure/src/plugins/my-new-feature/types';\r\n\r\n@VendurePlugin({\r\n imports: [PluginCommonModule],\r\n providers: [{ provide: MY_NEW_FEATURE_PLUGIN_OPTIONS, useFactory: () => MyNewFeaturePlugin.options }],\r\n configuration: config => {\r\n // Plugin-specific configuration\r\n // such as custom fields, custom permissions,\r\n // strategies etc. can be configured here by\r\n // modifying theconfig` object.\r\n return config;\r\n },\r\n compatibility: '^2.0.0',\r\n})\r\nexport class MyNewFeaturePlugin {\r\n static options: PluginInitOptions;\r\n\r\n static init(options: PluginInitOptions): Type {\r\n this.options = options;\r\n return MyNewFeaturePlugin;\r\n }\r\n}\r\n"
│ Stack: RangeError: Maximum call stack size exceeded
│ at Object.getCanonicalFileName (/alcosta-vendure/node_modules/@ts-morph/common/dist/ts-morph-common.js:1416:31)
│ at getCanonicalFileName (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:121251:19)
│ at toPath (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:6823:12)
│ at Object.getPackageJsonInfo2 [as getPackageJsonInfo] (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:39877:49)
│ at getPackageJsonInfo (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:40889:78)
│ at loadModuleFromSpecificNodeModulesDirectory (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:41548:23)
│ at loadModuleFromImmediateNodeModulesDirectory (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:41525:29)
│ at /alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:41513:33
│ at forEachAncestorDirectory (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:6975:22)
│ at lookup (/alcosta-vendure/node_modules/@ts-morph/common/dist/typescript.js:41507:14)
│ at throwError (/alcosta-vendure/node_modules/ts-morph/dist/ts-morph.js:2375:19)
│ at doManipulation (/alcosta-vendure/node_modules/ts-morph/dist/ts-morph.js:2373:9)
│ at replaceSourceFileForFilePathMove (/alcosta-vendure/node_modules/ts-morph/dist/ts-morph.js:2801:5)
│ at SourceFile._moveInternal (/alcosta-vendure/node_modules/ts-morph/dist/ts-morph.js:13424:9)
│ at SourceFile.move (/alcosta-vendure/node_modules/ts-morph/dist/ts-morph.js:13400:19)
│ at generatePlugin (/alcosta-vendure/node_modules/@vendure/cli/dist/commands/add/plugin/create-new-plugin.js:184:16)
│ at async Object.createNewPlugin [as run] (/alcosta-vendure/node_modules/@vendure/cli/dist/commands/add/plugin/create-new-plugin.js:90:54)
│ at async addCommand (/alcosta-vendure/node_modules/@vendure/cli/dist/commands/add/add.js:47:50)
│ at async Command. (/alcosta-vendure/node_modules/@vendure/cli/dist/cli.js:52:5)
│ at async Command.parseAsync (/alcosta-vendure/node_modules/@vendure/cli/node_modules/commander/lib/command.js:936:5)

└ ❌ Error

◇ Canceled
✨ Done in 10.52s.`

@DanZmanGrant
Copy link

I have had some issues with node modules not working as desired due to Apple Silicon incompatibility.

@michaelbromley michaelbromley moved this from 📋 Backlog to 🔖 Ready in Vendure OS Roadmap May 2, 2024
@michaelbromley michaelbromley moved this from 🔖 Ready to ✅ Done in Vendure OS Roadmap May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
Status: 🚀 Shipped
Development

No branches or pull requests

5 participants