saltyshiomix / nextron

⚡ Next.js + Electron ⚡
https://npm.im/nextron
MIT License
3.97k stars 229 forks source link

Error: Cannot find module 'mime' #2

Closed sarriaroman closed 6 years ago

sarriaroman commented 6 years ago

After the creation of a new project, when I try to tun npm run dev I'm getting the next error:

Error: Cannot find module 'mime'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/node_modules/send/index.js:24:12)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
(node:22046) UnhandledPromiseRejectionWarning: Error: Command failed: node_modules/.bin/next export renderer
module.js:549
    throw err;

The mime module is installed just in case. This wasn't happening with the version 0.6.7, I upgrade to the latest and start happening.

Thanks

sarriaroman commented 6 years ago

I tried a new project using with-typescript-material-ui with the same result.

sarriaroman commented 6 years ago

Installing modules with Yarn solves the problem but this is the new problem running with yarn dev

yarn dev                                                                                                                                                                                                                                   sarriaroman@macbook-pro
yarn run v1.7.0
$ nextron
env: node\r: No such file or directory
error Command failed with exit code 127.
sarriaroman commented 6 years ago

Running nextron with the global module works for dev.

saltyshiomix commented 6 years ago

Thank you for your trying nextron and sorry for inconvenience. I usually use Windows 7, so I'll test nextron with my Mac later today :)

If you have some time, could you tell me your node and npm versions? (you may use several versions of nodejs)

Thanks a lot for reporting bugs <3

saltyshiomix commented 6 years ago

I develop nextron mainly on Windows. But CLI files are DOS format of Windows, so UNIX format on Mac, we see env: node\r: No such file or directory error.

See this reference: https://stackoverflow.com/questions/30344858/node-script-executable-not-working-on-mac-env-node-r-no-such-file-or-directo

sarriaroman commented 6 years ago

Running dos2unix node_modules/nextron/**/* solves the issue. The problem as you said is with CRLF format in the files of the module.

To get installed dos2unix on mac: brew install dos2unix ( Homebrew must be installed previous to run the command )

saltyshiomix commented 6 years ago

Developed on my Windows and tested on my Mac, nextron@0.8.3 fixes this issue 👍

Have any other troubles?