D
D
Div-Man2018-11-08 11:22:12
Node.js
Div-Man, 2018-11-08 11:22:12

Why is next js not running?

I do everything according to the instructions https://nextjs.org/learn/basics/getting-started/setup
I start npm run dev
And display an error

[email protected] MINGW64 /f/nextjs/hello-next
$ npm run dev

> [email protected] dev F:\nextjs\hello-next
> next

> Couldn't find a `pages` directory. Please create one under the project root
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `next`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Div-Man\AppData\Roaming\npm-cache\_logs\2018-11-08T07_58_57_773Z-debug.log

$ node -v
 v10.6.0

 $ npm -v
 6.1.0

windows 8.1
package.json
{
  "name": "hello-next",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "next",
    "build": "next build",
    "start": "next start"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "next": "^7.0.2",
    "react": "^16.6.1",
    "react-dom": "^16.6.1"
  }
}

npm start

> [email protected] start F:\nextjs\hello-next
> next start

Error: Could not find a valid build in the 'F:\nextjs\hello-next\.next' director                 y! Try building your app with 'next build' before starting the server.
    at Server.readBuildId (F:\nextjs\hello-next\node_modules\next\dist\server\ne                 xt-server.js:753:15)
    at new Server (F:\nextjs\hello-next\node_modules\next\dist\server\next-serve                 r.js:80:25)
    at module.exports (F:\nextjs\hello-next\node_modules\next\dist\server\next.j                 s:6:10)
    at _callee$ (F:\nextjs\hello-next\node_modules\next\dist\server\lib\start-se                 rver.js:33:37)
    at tryCatch (F:\nextjs\hello-next\node_modules\regenerator-runtime\runtime.j                 s:62:40)
    at Generator.invoke [as _invoke] (F:\nextjs\hello-next\node_modules\regenera                 tor-runtime\runtime.js:288:22)
    at Generator.prototype.(anonymous function) [as next] (F:\nextjs\hello-next\                 node_modules\regenerator-runtime\runtime.js:114:21)
    at asyncGeneratorStep (F:\nextjs\hello-next\node_modules\@babel\runtime-core                 js2\helpers\asyncToGenerator.js:5:24)
    at _next (F:\nextjs\hello-next\node_modules\@babel\runtime-corejs2\helpers\a                 syncToGenerator.js:27:9)
    at F:\nextjs\hello-next\node_modules\@babel\runtime-corejs2\helpers\asyncToG                 enerator.js:34:7
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `next start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional log                 ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Div-Man\AppData\Roaming\npm-cache\_logs\2018-11-08T08_25_2                 3_194Z-debug.log

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Burov, 2018-11-08
@Div-Man

> Couldn't find a `pages` directory. Please create one under the project root
translate.google.com/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question