Skip to content

Module not found in examples/local-state-sharing. #1736

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

Closed
tarunama opened this issue Dec 25, 2021 · 0 comments · Fixed by #1737
Closed

Module not found in examples/local-state-sharing. #1736

tarunama opened this issue Dec 25, 2021 · 0 comments · Fixed by #1737
Labels
example Changes related to examples

Comments

@tarunama
Copy link

Bug report

~/p/o/local-state-sharing> yarn dev
yarn run v1.22.15
$ next
The module 'react' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install react'
The module 'react-dom' was not found. Next.js requires that you include it in 'dependencies' of your 'package.json'. To add it, run 'npm install react-dom'
internal/modules/cjs/loader.js:888
  throw err;
  ^

Error: Cannot find module 'react'
Require stack:
- /projects/oss/local-state-sharing/node_modules/next/dist/shared/lib/utils.js
- /Users//projects/oss/local-state-sharing/node_modules/next/dist/server/config.js
- /Users//projects/oss/local-state-sharing/node_modules/next/dist/server/next.js
- /Users//projects/oss/local-state-sharing/node_modules/next/dist/server/lib/start-server.js
- /Users//projects/oss/local-state-sharing/node_modules/next/dist/cli/next-dev.js
- /Users//projects/oss/local-state-sharing/node_modules/next/dist/bin/next
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
    at Function.Module._load (internal/modules/cjs/loader.js:730:27)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users//projects/oss/local-state-sharing/node_modules/next/dist/shared/lib/utils.js:15:14)
    at Module._compile (internal/modules/cjs/loader.js:1068:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/yamamototakuya/projects/oss/local-state-sharing/node_modules/next/dist/shared/lib/utils.js',
    '/Users/yamamototakuya/projects/oss/local-state-sharing/node_modules/next/dist/server/config.js',
    '/Users/yamamototakuya/projects/oss/local-state-sharing/node_modules/next/dist/server/next.js',
    '/Users/yamamototakuya/projects/oss/local-state-sharing/node_modules/next/dist/server/lib/start-server.js',
    '/Users/yamamototakuya/projects/oss/local-state-sharing/node_modules/next/dist/cli/next-dev.js',
    '/Users/yamamototakuya/projects/oss/local-state-sharing/node_modules/next/dist/bin/next'
  ]
}

Description / Observed Behavior

examples/local-state-sharing failed to execute yarn dev command.

Expected Behavior

examples/local-state-sharing execute yarn dev command.

To resolve this, add modules of react and react-dom ?

Repro Steps / Code Example

  1. curl https://codeload.github.com/vercel/swr/tar.gz/main | tar -xz --strip=2 swr-main/examples/local-state-sharing
  2. cd local-state-sharing
  3. yarn
  4. yarn dev

Additional Context

package.json

{
  "name": "local-state-sharing",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "next": "latest",
    "swr": "latest"
  },
  "scripts": {
    "dev": "next",
    "start": "next start",
    "build": "next build"
  }
}
@huozhi huozhi added the example Changes related to examples label Dec 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
example Changes related to examples
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants