Cannot find module in Electron

I am currently working on Electron with Babylon. I found this repo , which I mainly used as a template for my own project. Everything worked fine until I tried to add jquery.pep.js for other needs. I continue this error:

Unused error: cannot find jquery.pep.js module

I installed both libraries with "npm i -S jquery" and "npm i -S jquery.pep.js". To make jquery work, I added this script to the top of my index.html

<script> delete window.module; </script>

and this line is at the top of my main.js:

window.$ = window.jQuery = require('jquery');

Now jquery is working fine, but for some reason the jquery.pep.js module is still not found. I tried using "require" but I have the same error

main.js

window.$ = window.jQuery = require('jquery'); 
var pep = require('jquery.pep.js');



CSS/
img/
js/
- main.js
node_modules/
index.html
index.js
package.json
renderer.js

+4
1

-, node . node, . :

"find-me", :

require('find-me');

Node find-me.js , module.paths - .

$ node
> module.paths
[ '/Users/samer/learn-node/repl/node_modules',
  '/Users/samer/learn-node/node_modules',
  '/Users/samer/node_modules',
  '/Users/node_modules',
  '/node_modules',
  '/Users/samer/.node_modules',
  '/Users/samer/.node_libraries',
  '/usr/local/Cellar/node/7.7.1/lib/node' ]

node_modules . , .

node find-me.js , " ".

~/learn-node $ node
> require('find-me')
Error: Cannot find module 'find-me'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at repl:1:1
    at ContextifyScript.Script.runInThisContext (vm.js:23:33)
    at REPLServer.defaultEval (repl.js:336:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.onLine (repl.js:533:10)

, - , node module.paths, , .

+11

Source: https://habr.com/ru/post/1691678/


All Articles