Uncaught TypeError: ns.charCodeAt is not a function
See original GitHub issueenvironment: “next”: “latest”, “styled-components”: “^2.1.1”,
below is my demo code
// index.js
import React from 'react';
import styled from 'styled-components';
const Title = styled.h1`
font-size: 1.5em;
text-align: center;
color: #ddd;
`;
export default () => (
<div>
<Title>it is just an demo</Title>
</div>
);
// _document.js
import Document, { Head, Main, NextScript } from 'next/document';
import { ServerStyleSheet } from 'styled-components';
import flush from 'styled-jsx/server';
export default class MyDocument extends Document {
static getInitialProps({ renderPage }) {
const { html, head, errorHtml, chunks } = renderPage();
const styles = flush();
return { html, head, errorHtml, chunks, styles };
}
render() {
const sheet = new ServerStyleSheet();
const main = sheet.collectStyles(<Main />);
const styleTags = sheet.getStyleElement();
return (
<html lang="zh">
<Head>
<style>{'body { margin: 0 } /* custom! */'}</style>
{/* inject:js */}
<script src="../static/demo.js" />
{/* endinject */}
{styleTags}
</Head>
<body className="custom_class">
<div>root</div>
<div className="root">
{main}
</div>
<NextScript />
</body>
</html>
);
}
}
browser throw TypeError
but the Title
component is work still
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
Top Results From Across the Web
TypeError: str.charCodeAt is not a function - Stack Overflow
I updated to node version 6 today and that might've broke something. I tried to get back to node 5.10 but the issue...
Read more >JavaScript: Uncaught TypeError: n is not a function
This error occurs if you try to execute a function that is not initialized or is not initialized correctly. This means that the...
Read more >Charcodeat 不是一个函数javascript, 类型错误 - 免费编程教程
Uncaught TypeError: ns.charCodeAt is not a function · Issue #1033 ,当网站尝试加载检查器时显示以下错误: Uncaught TypeError: this._input.
Read more >Node.js v19.3.0 Documentation
If the function has not been called exactly exact times when tracker.verify() is called, then tracker.verify() will throw an error. import assert from...
Read more >t.charcodeat is not a function - You.com | The AI Search ...
TypeError : str.charCodeAt is not a function - Stack Overflow ... This could be an issue with some module not being entirely compatible...
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
I’ll close this due to its age and inactivity
Thanks @protoEvangelion for resurfacing it 😄
i try removing node_modules many times