8

I have reinstalled node js 3 times to run JS scripts and "npm run dev" is not starting up the server. This is quite frustrating.

Comments
  • 1
    What? Show your package.json file.
  • 1
  • 2
    There is nothing wrong with node, your configuration is not correct
  • 1
  • 2
    @devemperor In scripts sections are only 'build' and 'start' but you are trying to run 'dev'
  • 1
    @Kekica what should I do?
  • 2
    Run npm run start :)
  • 1
    @Kekica still giving me err!!
  • 1
    Yeah but not the same one 😁😁😂
  • 1
  • 4
    My advice: start some nodejs tutorials/course for beginners and leave webpack for some time.
  • 2
    npm install
    npm run build
    npm start

    Looks like this would be the way to go.
  • 2
    @devemperor do "npm run start" then post the error
  • 1
  • 2
    If you follow a tutorial how to do this you are clearly not following the steps correctly.
  • 5
    Start without webpack first, it’s kinda hard to configure webpack boilerplate
  • 2
    @devemperor
    I'm assuming you've done "npm install" successfully already, since there's a node_modules directory in your project.
    Try this just for funsies - in the start script in package.json, add the full path to webpack-dev-server - eg. "node_modules/someDir/webpack-dev-server"
    If that runs, you've either not installed webpack-dev-server gloablly, or it wasn't added to PATH properly on install
  • 3
    @xPunxNotDeadx you Taliban.
    Never install a dev depency globally.

    He's running a npm script. What matters is node_modules/.bin content and nothing else.
  • 3
    @devTea i guess the webpack is for frontend. I run into similar problem with react. Solve the problem by creating seperate npm projects for server and frontend. Node.js seems handle most es5 syntax without transform. Arrow, async etc.
  • 2
    Always run node --version. I have had the wrong version selected many times. Use NVM to manage the
  • 3
    @sunfishcc https://node.green
    Node handle most es7 syntax.

    The real difference in using webpack resides in all the loaders you can use (think module aliasing for instance) and how the code gets bundled afterwards (which is useless with node)
  • 3
    @jeeper agreed although he's using gitbash and nvm for windows isn't a paragon of stability
  • 3
    @Commodore it's also terrible about fully uninstalling things. Dangling settings can live many unsuspecting places
  • 3
    @Commodore you're right, but if he's successfully run npm install then something is borked - global install will prove or disprove this.
    My bet; OP hasn't run npm install successfully yet. Delete node_modules and npm install - ideally from PS console instead of bash to rule out winderps+bash issues
  • 3
    @xPunxNotDeadx now I can agree with you 😊
  • 2
    Fixed it. npm wasn't intalled successfully cause I ran the installation through vs code bash than PS. I removed the modules and reinstalled it again. thanks guys.
  • 2
    @Commodore I like what you said in the bracket! 😂
  • 2
    @Commodore you get extra points for the "you taliban" comment 🤣
  • 0
    @sunfishcc @xPunxNotDeadx thanks, glad you had some fun 😉
Add Comment