错误:找不到模块'./'

时间:2016-08-14 15:06:06

标签: javascript node.js ubuntu npm electron

我在尝试通过NPM启动我的应用程序时偶然发现了这个错误。我不确定问题出在哪里,因为它在我的其他计算机上工作正常(我将文件解压缩到这台计算机上运行,​​npm install以防万一,然后尝试启动它,但随后出现以下错误)。< / p>

任何帮助将不胜感激。

    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"
  }
}

更新

解决上述错误后,会抛出以下错误

我在Windows 10上通过bash运行它,并尝试安装所有必需的库,以便通过Windows上的npm start启动电子应用程序(在我的ubuntu中正常工作)

  

电子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>

1 个答案:

答案 0 :(得分:0)

shutdown检查失败是known issue。 Electron作为原生Windows应用程序运行得很好,所以只需要在Windows上使用Bash过度复杂化。