next.js: _next/static/style.css net::ERR_ABORTED 404 (Not Found)
Bug report
After update version 7, is not longer working the hot reload.
Describe the bug
Not longer works the hot reload, I force to refresh manually the browser in order to update my scss (I’m using next-sass)
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
npm run devopen browser with port defined and you will able to show the bug
Expected behavior
After change my sass files, the browser should update their style properly.
Screenshots
This is the console log of chrome with the error:
System information
- OS: MacOs 10.13.6
- Browser chrome
- Package dependencies:
"@zeit/next-sass": "^1.0.2-canary.0",
"babel-polyfill": "^6.26.0",
"classnames": "^2.2.6",
"cross-fetch": "^2.2.2",
"express": "^4.16.4",
"fs": "0.0.1-security",
"immutable": "^3.8.2",
"lodash": "^4.17.10",
"next": "^7.0.2-canary.21",
"next-redux-wrapper": "^2.0.0",
"node-sass": "4.9.4",
"prop-types": "^15.6.2",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-notification-system": "^0.2.17",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-devtools-extension": "^2.13.5",
"redux-immutable": "^4.0.0",
"redux-thunk": "^2.3.0"
my dev dependencies:
"devDependencies": {
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^8.2.6",
"babel-jest": "22.4.3",
"babel-plugin-module-resolver": "^3.1.1",
"chai": "^4.1.2",
"enzyme": "3.2.0",
"enzyme-adapter-react-16": "1.5.0",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^17.0.0",
"eslint-plugin-import": "^2.13.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-react": "^7.10.0",
"husky": "^0.14.3",
"jest": "22.0.1",
"lint-staged": "^7.3.0",
"prettier-eslint": "^8.8.2",
"react-addons-test-utils": "15.6.2",
"react-test-renderer": "16.2.0",
"sinon": "^6.1.5",
"superagent": "^4.0.0-beta.5",
"supertest": "^3.3.0"
}
my next.config.js
const withSass = require('@zeit/next-sass');
const getRoutes = require('./routes');
module.exports = {
assetPrefix: process.env.NODE_ENV === 'production' ? '/{reponame}' : '',
exportPathMap: getRoutes,
generateBuildId: async () => {
const id = process.env.BUILD_ID;
return id;
}
};
module.exports = withSass();
my _document
// Libs
import Document, {Head, Main, NextScript} from "next/document";
export default class MyDocument extends Document {
render() {
return (
<html lang="en">
<Head>
<link rel="stylesheet" href="/_next/static/style.css"/>
</Head>
<body>
<Main/>
<NextScript/>
</body>
</html>
);
}
}
NOTE: if I remove the link import from here, seems like it works, but when I change the page, the other page is completely un-styled
Additional context
I try a lot of things, such remove node_module, npm install again, add empty style into _app, everything that I found out there, and nothing seems like works for this bug.
I will really appreciate if someone have a cue about what’s going on.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (10 by maintainers)
I was also getting 404s on my CSS bundle. In my case, the problem was not related to Next.js, the problem is serving cached HTML that refers to css files that are no longer in the file system (which can happen easily when self-deploying).
Steps to Reproduce
Solution Bust caches upon deploys, or come up with some other clever caching strategy.