Sign in
Log inSign up

Having a problem using Node.js to render React server-side

Marvin Dick's photo
Marvin Dick
·Apr 30, 2018

This is the project concerning the problem: github.com/mdick1611/react-konzertportal-n…

My package.json looks like this:

{
  "name": "react-konzertportal-navbar",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.3.2",
    "react-dom": "^16.3.2",
    "react-scripts": "1.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "transpile": "NODE_ENV=production babel src --out-dir transpiled --presets es2015,react-app",
    "start:prod": "NODE_ENV=production node server.js"
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-preset-es2015": "^6.24.1"
  }
}

When I try to run the npm run start:prod script after building and transpiling, I get the following error thrown:

    throw err;
    ^

Error: Cannot find module './App.css'
    at Function.Module._resolveFilename (module.js:542:15)
    at Function.Module._load (module.js:472:25)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\Marvin\WebstormProjects\react-konzertportal-navbar\transpiled\App.js:13:1)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)