require is not defined
hut36 opened this issue · comments
How to reproduce:
- run
npx create-blogster@latest --theme sleek
- run
cd my-blogster-blog
- run
yarn run dev --host
- visit http://127.0.0.1:3000/blog/basic-markdown-style-guide
The page displays an error message:
require is not defined
/my-blogster-blog/.yarn/cache/prismjs-npm-1.29.0-6faa5b04b8-007a8869d4.zip/node_modules/prismjs/components/index.js:1:33
> 1 | const components = require('../components.js');
| ^
2 | const getLoader = require('../dependencies');
ReferenceError: require is not defined
at /.yarn/cache/prismjs-npm-1.29.0-6faa5b04b8-007a8869d4.zip/node_modules/prismjs/components/index.js:1:33
at instantiateModule (file:///my-blogster-blog/.yarn/__virtual__/vite-virtual-2b0880e296/0/cache/vite-npm-3.2.5-f23b9ecb5b-ad35b7008c.zip/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53364:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5
Other information:
- platform: MacOS
- yarn 3.3.0
- node 18.12.1
Is this a yarn
version issue? I tried with node@16, node@18 and node@19 in MacOS and things work as you'd expect them to. I'm on yarn v1. Perhaps one of the dependency has a problem with yarn v3. Could you try deleting node_modules
and yarn.lock
and try installing the dependencies using npm
or even pnpm
to see if the problem is really with yarn v3?
Tried npm and yarn v1 and both worked. So this is perhaps a yarn version issue as you said. Thanks for help!
Probably one (or a few) of the dependencies is not compatible with yarn 2/3 pnp - https://yarnpkg.com/features/pnp
This happens with PNPM too, however simply updating the packages to their latest version fixes this.