X Tutup
The Wayback Machine - https://web.archive.org/web/20201209134747/https://github.com/mui-org/material-ui/issues/23901
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

Can't run the latest preact example successfully #23901

Open
onegrit opened this issue Dec 9, 2020 · 1 comment
Open

Can't run the latest preact example successfully #23901

onegrit opened this issue Dec 9, 2020 · 1 comment

Comments

@onegrit
Copy link

@onegrit onegrit commented Dec 9, 2020

When I run 'yarn start' in preact example after installing, I met the following error:

ironman@DT:~/projects/preact$ yarn start
yarn run v1.22.5
$ react-app-rewired start
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'react'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.resolve (internal/modules/cjs/helpers.js:33:19)
    at Object.<anonymous> (/home/ironman/projects/preact/node_modules/react-scripts/scripts/start.js:52:31)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
error Command failed with exit code 1.

Within the same environment, the example of styled-components and gatsby can work.
This issue has tortured me for 1 day, I don’t know how to solve this problem, I look forward to advices. Thanks.
BTW, the codesandbox preact example can't work either.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯
Continue google

Expected Behavior 🤔

Steps to Reproduce 🕹

Steps:

  1. curl https://codeload.github.com/mui-org/material-ui/tar.gz/next | tar -xz --strip=2 material-ui-next/examples/preact
  2. cd preact
  3. npm install or yarn install
  4. npm run start or yarn start

Context 🔦

Your Environment 🌎

  System:
    OS: Linux 4.19 Ubuntu 20.04.1 LTS (Focal Fossa) [Note: WSL 2 in Windows 10]
  Binaries:
    Node: 10.23.0 - ~/.nvm/versions/node/v10.23.0/bin/node [Note: I have tried using Node v14 or v15 ]
    Yarn: 1.22.5 - /usr/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v10.23.0/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @emotion/react: latest => 11.1.2 
    @emotion/styled: latest => 11.0.0 
    @material-ui/core: next => 5.0.0-alpha.18 
    @material-ui/styled-engine:  5.0.0-alpha.18 
    @material-ui/styles:  5.0.0-alpha.18 
    @material-ui/system:  5.0.0-alpha.18 
    @material-ui/types:  5.1.0 
    @material-ui/unstyled:  5.0.0-alpha.18 
    @material-ui/utils:  5.0.0-alpha.18 
    @types/react:  17.0.0 
@mnajdova
Copy link
Member

@mnajdova mnajdova commented Dec 9, 2020

@onegrit the only solution that worked for me was downgrading the react-script version

diff --git a/examples/preact/package.json b/examples/preact/package.json
index 03dcddbf62..5c60bcdc8a 100644
--- a/examples/preact/package.json
+++ b/examples/preact/package.json
@@ -11,7 +11,7 @@
     "@testing-library/user-event": "latest",
     "preact": "latest",
     "preact-compat": "latest",
-    "react-scripts": "latest"
+    "react-scripts": "^3.4.3"
   },
   "scripts": {
     "start": "react-app-rewired start",

Let me know if this works for you. I know it's not the ideal solution, but wasn't able to find anything better.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.
X Tutup