简体   繁体   中英

Error: Cannot find module './'

I stumbled upon this error when trying to start my application via NPM start. I am not sure where the problem lies, because it worked fine in my other computer (I unzip the file to this computer ran, npm install just in case and then tried to start it, but then the following error is thrown below).

Any help would be appreciated.

    module.js:340
        throw err;
              ^
    Error: Cannot find module './'
        at Function.Module._resolveFilename (module.js:338:15)
        at Function.Module._load (module.js:280:25)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
        at Object.<anonymous> (/mnt/c/Users/Jonathan/Desktop/client/<NAME>/node_modules/.bin/electron:3:16)
        at Module._compile (module.js:456:26)
        at Object.Module._extensions..js (module.js:474:10)
        at Module.load (module.js:356:32)
        at Function.Module._load (module.js:312:12)
        at Function.Module.runMain (module.js:497:10)

    npm ERR! Linux 3.4.0+
    npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
    npm ERR! node v0.10.46
    npm ERR! npm  v2.15.1
    npm ERR! code ELIFECYCLE
    npm ERR! <NAME>@0.0.0 start: `electron main.js`
    npm ERR! Exit status 8
    npm ERR!
    npm ERR! Failed at the <NAME>@0.0.0 start script 'electron main.js'.
    npm ERR! This is most likely a problem with the <NAME> package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     electron main.js
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs <NAME>
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!
    npm ERR!     npm owner ls <NAME>
    npm ERR! There is likely additional logging output above.

package.json

{
  "name": "<NAME>",
  "version": "0.0.0",
  "description": "[..]",
  "main": "index.js",
  "build": {
    "appId": "test.321",
    "app-category-type": "your.app.category.type",
    "win": {
      "iconUrl": "http://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon.png"
    }
  },
  "scripts": {
    "start": "electron main.js",
    "postinstall": "install-app-deps",
    "pack": "build --dir",
    "dist": "build"
  },
  "author": "john@gmail.com>",
  "license": "ISC",
  "devDependencies": {
    "electron": "^1.3.3",
    "electron-installer-squirrel-windows": "^1.3.0",
    "electron-packager": "^7.5.1"
  }
}

UPDATE

After solving the above error, the following error is thrown

I am running this through bash on windows 10, and have tried to install all required libraries to get the electron app to start via npm start on windows (works fine in my ubuntu)

electron main.js

    [8002:0814/084446:FATAL:render_sandbox_host_linux.cc(40)] Check failed: 0 == shutdown(renderer_socket_, SHUT_RD). shutdown: Invalid argument
    #0 0x000001e098ce <unknown>
    #1 0x000001e1f4db <unknown>
    #2 0x000001e1fa9d <unknown>
    #3 0x000002892fc2 <unknown>
    #4 0x00000265e599 <unknown>
    #5 0x000002664b5f <unknown>
    #6 0x00000265dc36 <unknown>
    #7 0x000001204157 <unknown>
    #8 0x000001202c30 <unknown>
    #9 0x0000033a9470 main
    #10 0x7fe5ec701f45 __libc_start_main
    #11 0x000000575039 <unknown>

The shutdown check fail is a known issue . Electron runs just fine as a native Windows app, so just do that instead of over-complicating things with Bash on Windows.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM