Bug: It doesn't work with windows
See original GitHub issueESBuild seems to fail to install As seen, there is no binary. Config: https://sourceb.in/BSbso4rW2k
node:events:368
throw er; // Unhandled 'error' event
^
Error: spawn C:\Users\milo5\Desktop\GitHub\website\node_modules\@contentlayer\core\node_modules\esbuild\bin\esbuild ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn C:\\Users\\milo5\\Desktop\\GitHub\\website\\node_modules\\@contentlayer\\core\\node_modules\\esbuild\\bin\\esbuild',
path: 'C:\\Users\\milo5\\Desktop\\GitHub\\website\\node_modules\\@contentlayer\\core\\node_modules\\esbuild\\bin\\esbuild',
And that’s the error. More context:
Next.config.js
const { withContentlayer } = require('next-contentlayer');
/**
* @type {import('next').NextConfig}
*/
module.exports = withContentlayer()({
reactStrictMode: true,
async headers() {
return [
{
source: '/(.*)',
headers: securityHeaders,
},
];
},
webpack: (config, { dev, isServer }) => {
// Replace React with Preact only in client production build
if (!dev && !isServer) {
Object.assign(config.resolve.alias, {
react: 'preact/compat',
'react-dom': 'preact/compat',
});
}
return config;
},
});
// https://securityheaders.com
const ContentSecurityPolicy = `
default-src 'self';
script-src 'self' 'unsafe-eval' 'unsafe-inline' *.youtube.com *.twitter.com cdn.usefathom.com;
child-src *.youtube.com *.google.com *.twitter.com;
style-src 'self' 'unsafe-inline' *.googleapis.com;
img-src * blob: data:;
media-src 'none';
connect-src *;
font-src 'self';
`;
const securityHeaders = [
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
{
key: 'Content-Security-Policy',
value: ContentSecurityPolicy.replace(/\n/g, ''),
},
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin',
},
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
{
key: 'X-Frame-Options',
value: 'DENY',
},
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-DNS-Prefetch-Control
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
{
key: 'Strict-Transport-Security',
value: 'max-age=31536000; includeSubDomains; preload',
},
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
// Opt-out of Google FLoC: https://amifloced.org/
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=(), interest-cohort=()',
},
];
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Error: Windows Explorer has stopped working
Outdated or corrupt video drivers can cause Windows Explorer to stop working. Downloading and installing the latest video driver can solve many of...
Read more >Get help with Windows activation errors - Microsoft Support
Learn how to troubleshoot Windows activation errors. Browse common activation errors and learn what you can do to fix them.
Read more >Troubleshoot problems updating Windows - Microsoft Support
Learn how to troubleshoot problems updating Windows. Find answers to common questions and issues installing Windows updates.
Read more >Fix Windows Update errors - Microsoft Support
The steps in this guided walk-through should help with all Windows Update errors and other issues—you don't need to search for the specific...
Read more >Fix problems in Windows Search - Microsoft Learn
If Windows Search is unresponsive or the search results don't appear as expected, try any of the following solutions in this article.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s now released in https://github.com/contentlayerdev/contentlayer/releases/tag/v0.0.28
@AkashRajpurohit I’ve released a preview version with Windows support. You can try installing it via
yarn add contentlayer@0.0.28-dev.12 next-contentlayer@0.0.28-dev.12
. I’ll release a stable version soon.