craft.js icon indicating copy to clipboard operation
craft.js copied to clipboard

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

Open XamHans opened this issue 3 years ago • 15 comments

./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.

XamHans avatar Sep 26 '22 20:09 XamHans

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

AminRafaey avatar Sep 27 '22 09:09 AminRafaey

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

martin-dimi avatar Sep 27 '22 10:09 martin-dimi

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: [email protected]
npm ERR! Found: [email protected]
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 [email protected]
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: [email protected]
npm ERR! node_modules/eslint-plugin-flowtype
npm ERR!   peer eslint-plugin-flowtype@"3.x" from [email protected]
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

tsaunde123 avatar Sep 27 '22 10:09 tsaunde123

try yarn instead of npm

yarn add @craftjs/core

yusuf-mutlu avatar Sep 27 '22 10:09 yusuf-mutlu

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'

martin-dimi avatar Sep 27 '22 10:09 martin-dimi

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

yusuf-mutlu avatar Sep 27 '22 14:09 yusuf-mutlu

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

XamHans avatar Sep 30 '22 08:09 XamHans

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.

martin-dimi avatar Sep 30 '22 10:09 martin-dimi

Any update?

ilomon10 avatar Dec 06 '22 13:12 ilomon10

I am also running into similar issues.

ccaspanello avatar Jan 22 '23 20:01 ccaspanello

I am also running into similar issues.

3610cn avatar Feb 02 '23 06:02 3610cn

I managed to get it work via

  1. touch yarn.lock
  2. yarn
  3. yarn start

reboottime avatar Jun 21 '23 01:06 reboottime

This is what worked for me:

in the project root:

yarn install
yarn build
cd examples/landing 
yarn install
yarn start

DenysVuika avatar Feb 12 '24 15:02 DenysVuika

doesn't work

buzzo123 avatar Apr 13 '24 15:04 buzzo123

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.

IsrarAnsari01 avatar Jun 24 '24 21:06 IsrarAnsari01