Next.js: any ideas ? ... hello-world, Internal Server Error, Error: Cannot find module

Created on 27 Mar 2017  路  13Comments  路  Source: vercel/next.js

I am trying this out for the first time, and starting with hello-world examples.

https://github.com/zeit/next.js/tree/master/examples/hello-world

download is fine
npm install is fine
node_modules looks fine
npm run dev looks good

accessing these urls show the errors belot

http://localhost:3000/
http://localhost:3000/about

in browser ... Internal Server Error
in command line ... Error: Cannot find module

Most helpful comment

It didn't work for me on PowerShell but works fine on minntty (Git Bash).

All 13 comments

@jwaala Can you paste the whole error?

sure thing ...

$ taskkill /f /im node.exe; npm run dev
SUCCESS: The process "node.exe" with PID 22204 has been terminated.
SUCCESS: The process "node.exe" with PID 23652 has been terminated.

> [email protected] dev D:\Ohmy\Play\Nextjs\hello-world
> next

loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
 DONE  Compiled successfully in 16312ms3:51:48 PM

> Ready on http://localhost:3000
{ [Error: Cannot find module D:\Ohmy\Play\Nextjs\hello-world\.next\dist\pages\_error] code: 'ENOENT' }
{ [Error: Cannot find module D:\Ohmy\Play\Nextjs\hello-world\.next\dist\pages\_error] code: 'ENOENT' }
{ [Error: Cannot find module D:\Ohmy\Play\Nextjs\hello-world\.next\dist\pages\_error] code: 'ENOENT' }
{ [Error: Cannot find module D:\Ohmy\Play\Nextjs\hello-world\.next\dist\pages\_error] code: 'ENOENT' }


my node install on this system turned out to be very old, 4.6.0 ... with the latest 7.8.0, I am seeing this at the command line now

{ Error: Cannot find module D:\Tidalx\Tidal\jjj\hello-world\.next\dist\pages\_error
    at _callee$ (D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\dist\server\resolve.js:220:19)
    at tryCatch (D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\node_modules\babel-runtime\node_modules\regenerator-runtime\runtime.js:64:40)
    at Generator.invoke [as _invoke] (D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\node_modules\babel-runtime\node_modules\regenerator-runtime\runtime.js:299:22)
    at Generator.prototype.(anonymous function) [as next] (D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\node_modules\babel-runtime\node_modules\regenerator-runtime\runtime.js:116:21)
    at step (D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
    at D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\node_modules\babel-runtime\helpers\asyncToGenerator.js:28:13 code: 'ENOENT' }
{ Error: Cannot find module D:\Tidalx\Tidal\jjj\hello-world\.next\dist\pages\_error
    at _callee$ (D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\dist\server\resolve.js:220:19)
    at tryCatch (D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\node_modules\babel-runtime\node_modules\regenerator-runtime\runtime.js:64:40)
    at Generator.invoke [as _invoke] (D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\node_modules\babel-runtime\node_modules\regenerator-runtime\runtime.js:299:22)
    at Generator.prototype.(anonymous function) [as next] (D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\node_modules\babel-runtime\node_modules\regenerator-runtime\runtime.js:116:21)
    at step (D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
    at D:\TIDALX\Tidal\jjj\hello-world\node_modules\next\node_modules\babel-runtime\helpers\asyncToGenerator.js:28:13 code: 'ENOENT' }

I'm having the exact same issue, did you find a solution?

I'm having the same issue, with no luck. I already deleted de node_modules folder, reinstalled node. Downloaded the last branch where it did not work and still stuck.

OK, I managed to work around the issue. Instead of being in ~/Documents/projects/<project-name> I tested it in ~/Downloads/<project-name>. And it worked. I have no idea why. I guess it could be resolving the absolute path and it can only handle path lengths up to a certain length or something?

I don't have SELinux or anything like that running that could interfere AFAIK. The directories have the same permissions on them. Running Debian Stretch, node 6.10.2.

It didn't work for me on PowerShell but works fine on minntty (Git Bash).

I also had problems on PowerShell, but after reading alchem7st's comment above I tried in bash and it works. It also seems to work fine in cmd, so it's a psh problem

mine doesnt work in neither git bash nor powershell
anyone have a solution for this?

Hi dudes, so i get this issue with all my projects if I start it with git bash, but if I do it in the windows cmd it works fine, Is there a workaround that I could do to run this in Git BASH? I already tried it with elevated permissions. Thank you.

I was getting Internal Server Error after following the setup steps in the README.

If anyone has issues with this, try the solution by @msl-kabo.

I had my project in ~/c/Users/<username>/Desktop/<project-name> but after moving it down to ~/c/Users/<project-name> I was able to run npm run dev without any issues on Windows 10 (npm v5.3.0 and node v8.5.0).

Was having the same issue. Neither Powershell, Git Bash, nor relocating project folder closer to root directory of file system worked; only running from CMD terminal works (node 8.3.0; npm 5.3.0; Windows 10).

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olifante picture olifante  路  3Comments

formula349 picture formula349  路  3Comments

lixiaoyan picture lixiaoyan  路  3Comments

YarivGilad picture YarivGilad  路  3Comments

kenji4569 picture kenji4569  路  3Comments