prevwong / craft.js

🚀 A React Framework for building extensible drag and drop page editors
https://craft.js.org
MIT License
7.52k stars 725 forks source link

Can't resolve '@craftjs/core' in landing example #462

Open XamHans opened 1 year ago

XamHans commented 1 year ago
./components/editor/RenderNode.tsx:1:0
Module not found: Can't resolve '@craftjs/core'
> 1 | import { useNode, useEditor } from '@craftjs/core';
  2 | import { ROOT_NODE } from '@craftjs/utils';
  3 | import React, { useEffect, useRef, useCallback } from 'react';
  4 | import ReactDOM from 'react-dom';

Thats happening in the landing example in the dev as well as main branch.

AminRafaey commented 1 year ago

@craftjs/core package might not be installed. Just run this command, npm i @craftjs/core.

martin-dimi commented 1 year ago

I'm getting the same error when installing the basic example. There are dependency conflicts so core is not getting installed

tsaunde123 commented 1 year ago

I get the same, some dependencies issues present when running npm install. I can install using npm install --legacy-peer-deps but then there are issues with @carftjs/core

➜  basic git:(develop) ✗ npm i @craftjs/core
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: eslint-config-react-app@5.1.0
npm ERR! Found: eslint-plugin-flowtype@4.5.3
npm ERR! node_modules/eslint-plugin-flowtype
npm ERR!   dev eslint-plugin-flowtype@"4.5.3" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-flowtype@"3.x" from eslint-config-react-app@5.1.0
npm ERR! node_modules/eslint-config-react-app
npm ERR!   dev eslint-config-react-app@"5.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: eslint-plugin-flowtype@3.13.0
npm ERR! node_modules/eslint-plugin-flowtype
npm ERR!   peer eslint-plugin-flowtype@"3.x" from eslint-config-react-app@5.1.0
npm ERR!   node_modules/eslint-config-react-app
npm ERR!     dev eslint-config-react-app@"5.1.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/tristansaunders/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tristansaunders/.npm/_logs/2022-09-27T10_40_13_521Z-debug-0.log
yusuf-mutlu commented 1 year ago

try yarn instead of npm

yarn add @craftjs/core

martin-dimi commented 1 year ago

Same issue:

event - compiled successfully
event - build page: /
wait  - compiling...
info  - Using external babel configuration from /home/fridge/Documents/test/craft.js/examples/basic/.babelrc
error - ../../node_modules/@craftjs/core/dist/esm/index.js:1:0
Module not found: Can't resolve '@craftjs/utils'
yusuf-mutlu commented 1 year ago

@martin-dimi try deleting node_modules folder and then do yarn install

XamHans commented 1 year ago

Tried everything, like deleting node_modules then install only core package, but it still doesnt work ?

martin-dimi commented 1 year ago

I got it working by downgrading to @craftjs/core (utils and layers too for the other example) to ^0.2.0-beta.7 and using "@material-ui/core": "latest". In any case, on a clean repo clone, npm/yarn don't seem to work out of the box it seems.

ilomon10 commented 1 year ago

Any update?

ccaspanello commented 1 year ago

I am also running into similar issues.

3610cn commented 1 year ago

I am also running into similar issues.

reboottime commented 1 year ago

I managed to get it work via

  1. touch yarn.lock
  2. yarn
  3. yarn start
DenysVuika commented 6 months ago

This is what worked for me:

in the project root:

yarn install
yarn build
cd examples/landing 
yarn install
yarn start
buzzo123 commented 4 months ago

doesn't work

IsrarAnsari01 commented 2 months ago

Temporary Solution Steps (Until Permanent Fix):

  1. Modify the versions of @craftjs/core and layers:
    • Update @craftjs/core from "workspace:*" to "^0.2.0-beta.4".
    • Update @craftjs/layers from "workspace:*" to "^0.2.0-beta.4".
  2. Run yarn add to update dependencies.
  3. Start the application using yarn start.

This workaround should address the issue temporarily until a permanent fix is implemented.