How do you get NodeJS to look for modules not just in "no_modules"?



  • Let's say there's a project:

    введите сюда описание изображения

    I'm trying to write a violin. init.bat I'm going to start the server. When I get out of bat file or command line, I get a mistake. cannot find module 'core/base/globals'

    It's about the file. server.js There's a line. require('core/base/globals'); That's the one that connects this file.

    If I write this: require('../core/base/globals') - it'll work. But the point is, with this tape: require('core/base/globals'); The server will be swallowed if it's launched through the WebStorm and the cmd is not. Acting from the root of the project in cmd: set NODE_PATH="." && set NODE_ENV="development" && node --use_strict bin/server I'm getting a mistake. Error: Cannot find module 'core/base/globals'

    I want to understand how the WebStorm project starts to avoid altering all the records (there's so much) and require them: ../../../../../myFile♪ And it's not possible to lay everything in the node_modules, because the structure of the application does not allow it to be redesigned.

    Who's been dealing with such things? Any ideas?



  • set NODE_PATH=".;core/..;" && node bin/server
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2