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

Error when trying to launch a project for local development #5302

Open
xzdwq opened this issue Nov 12, 2024 · 1 comment
Open

Error when trying to launch a project for local development #5302

xzdwq opened this issue Nov 12, 2024 · 1 comment

Comments

@xzdwq
Copy link

xzdwq commented Nov 12, 2024

Q&A (please complete the following information)

  • OS: windows 10
  • Browser: chrome
  • Version: 130
  • Method of installation: npm
  • Swagger-Editor version: 5.0.0-alpha.96

Content & configuration

I am trying to run swagger-editor-next locally
I followed the startup instructions:

 $ git submodule init
 $ git submodule update
 $ npm i
 $ npm start

and I got an error:

ERROR in ./src/plugins/editor-monaco/components/MonacoEditor/MonacoEditor.jsx 8:0-40
Module not found: Error: You attempted to import /node_modules/monaco-editor which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
You can either move it inside src/, or add a symlink to it from project's node_modules/.

I also checked:

npm ls monaco-editors

[email protected] C:\Users\zhivovi\develop\swagger-editor
+-- monaco-editor@npm:@codingame/[email protected]
`-- [email protected] -> .\create-react-app\packages\react-scripts
  `-- monaco-editor@npm:@codingame/[email protected] deduped

And I tried npm dedupe but the mistake remained the same

I know that these are the features of react-create-app, but I'm not sure that I should somehow solve this through overrides

Screenshots

image

image

@xzdwq
Copy link
Author

xzdwq commented Nov 14, 2024

the solution worked for me:

  • in the package.json
    "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@=5.2.0",
    replace with:
    "@codingame/monaco-vscode-editor-api": "5.2.0",

  • npm i

  • in all files in the src/
    import directory * as monaco from 'monaco-editor';
    replace with:
    import * as monaco from '@codingame/monaco-vscode-editor-api';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant