bozon icon indicating copy to clipboard operation
bozon copied to clipboard

ModuleNotFoundError: dependency already declared in package.json not usable

Open mtenrero opened this issue 4 years ago • 7 comments

Hello, this issue would be probably considered as a newbie bozon user question.

I'm having problems using dependencies declared in package.json in the main process js file:

"dependencies": {
    "pouchdb-adapter-leveldb": "^7.1.1",
    "rxdb": "^8.7.5"
  },
  "devDependencies": {
    "bozon": "0.10.7",
    "mocha": "^7.0.0",
    "spectron": "^9.0.0"
  },

The error given is:

× Webpack failed to bundle application
[
  ModuleNotFoundError: Module not found: Error: Can't resolve 'pouchdb-adapter-leveldb' in 'C:\Users\marcostm\Documents\personal\mivet_bozon\src\main'
      at C:\Users\marcostm\scoop\persist\nodejs\bin\node_modules\bozon\node_modules\webpack\lib\Compilation.js:925:10
      at C:\Users\marcostm\scoop\persist\nodejs\bin\node_modules\bozon\node_modules\webpack\lib\NormalModuleFactory.js:401:22
      at C:\Users\marcostm\scoop\persist\nodejs\bin\node_modules\bozon\node_modules\webpack\lib\NormalModuleFactory.js:130:21
      at C:\Users\marcostm\scoop\persist\nodejs\bin\node_modules\bozon\node_modules\webpack\lib\NormalModuleFactory.js:224:22
      at C:\Users\marcostm\scoop\persist\nodejs\bin\node_modules\bozon\node_modules\neo-async\async.js:2830:7
      at C:\Users\marcostm\scoop\persist\nodejs\bin\node_modules\bozon\node_modules\neo-async\async.js:6877:13
      at C:\Users\marcostm\scoop\persist\nodejs\bin\node_modules\bozon\node_modules\webpack\lib\NormalModuleFactory.js:214:25
      at C:\Users\marcostm\scoop\persist\nodejs\bin\node_modules\bozon\node_modules\enhanced-resolve\lib\Resolver.js:213:14
      at C:\Users\marcostm\scoop\persist\nodejs\bin\node_modules\bozon\node_modules\enhanced-resolve\lib\Resolver.js:285:5
      at eval (eval at create (C:\Users\marcostm\scoop\persist\nodejs\bin\node_modules\bozon\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:13:1)
  resolve 'pouchdb-adapter-leveldb' in 'C:\Users\marcostm\Documents\personal\mivet_bozon\src\main'
    Parsed request is a module

mtenrero avatar Feb 04 '20 11:02 mtenrero

@mtenrero Try rm -rf node_modules and npm install. Looks like dependency is declared in package.json, but is not present in node_modules.

alchaplinsky avatar Feb 04 '20 12:02 alchaplinsky

@mtenrero Try rm -rf node_modules and npm install. Looks like dependency is declared in package.json, but is not present in node_modules.

I've also done that, It seem to not be detecting the dependencies....

Probably would be related with webpack?

mtenrero avatar Feb 04 '20 13:02 mtenrero

What do you have in your 'webpack.config.js'?

alchaplinsky avatar Feb 04 '20 15:02 alchaplinsky

Anything..

module.exports = {
  renderer: {},
  preload: {},
  main: {}
}

mtenrero avatar Feb 04 '20 15:02 mtenrero

Ok, so webpack should look for imported modules in node_modules directory. Can you confirm that there's pouchdb-adapter-leveldb folder in ./node_modules?

alchaplinsky avatar Feb 07 '20 09:02 alchaplinsky

i have same bug ... any solution ... please

fawzywassel avatar Mar 02 '20 15:03 fawzywassel

ModuleNotFoundError: Module not found: Error: Can't resolve 'pouchdb-adapter-leveldb' so if the file is in your node_modules the only issue is your not importing it the correct way

andrewo0 avatar Apr 04 '21 08:04 andrewo0