Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
e363e737
Commit
e363e737
authored
Jan 05, 2017
by
Arana Jhonny
Committed by
Guillermo Rauch
Jan 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Improve "pages/ not found error" (#624)
* fix not found error * add comment
parent
b8373b84
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
8 deletions
+33
-8
next-build
bin/next-build
+19
-1
next-dev
bin/next-dev
+14
-7
No files found.
bin/next-build
View file @
e363e737
#!/usr/bin/env node
import
{
resolve
}
from
'path'
import
{
resolve
,
join
}
from
'path'
import
{
exists
}
from
'mz/fs'
import
parseArgs
from
'minimist'
import
build
from
'../server/build'
...
...
@@ -27,6 +28,23 @@ if (argv.help) {
const
dir
=
resolve
(
argv
.
_
[
0
]
||
'.'
)
// Check if pages dir exists and warn if not
exists
(
dir
)
.
then
(
async
()
=>
{
if
(
!
(
await
exists
(
join
(
dir
,
'pages'
))))
{
if
(
await
exists
(
join
(
dir
,
'..'
,
'pages'
)))
{
console
.
error
(
'> No `pages` directory found. Did you mean to run `next` in the parent (`../`) directory?'
)
}
else
{
console
.
error
(
'> Couldn
\'
t find a `pages` directory. Please create one under the project root'
)
}
process
.
exit
(
1
)
}
})
.
catch
((
err
)
=>
{
console
.
error
(
err
)
process
.
exit
(
1
)
})
build
(
dir
)
.
catch
((
err
)
=>
{
console
.
error
(
err
)
...
...
bin/next-dev
View file @
e363e737
...
...
@@ -37,14 +37,9 @@ if (argv.help) {
const
dir
=
resolve
(
argv
.
_
[
0
]
||
'.'
)
const
srv
=
new
Server
({
dir
,
dev
:
true
})
srv
.
start
(
argv
.
port
)
// Check if pages dir exists and warn if not
exists
(
dir
)
.
then
(
async
()
=>
{
if
(
!
process
.
env
.
NOW
)
{
console
.
log
(
`> Ready on http://localhost:
${
argv
.
port
}
`
)
}
// Check if pages dir exists and warn if not
if
(
!
(
await
exists
(
join
(
dir
,
'pages'
))))
{
if
(
await
exists
(
join
(
dir
,
'..'
,
'pages'
)))
{
console
.
error
(
'> No `pages` directory found. Did you mean to run `next` in the parent (`../`) directory?'
)
...
...
@@ -58,3 +53,15 @@ srv.start(argv.port)
console
.
error
(
err
)
process
.
exit
(
1
)
})
const
srv
=
new
Server
({
dir
,
dev
:
true
})
srv
.
start
(
argv
.
port
)
.
then
(
async
()
=>
{
if
(
!
process
.
env
.
NOW
)
{
console
.
log
(
`> Ready on http://localhost:
${
argv
.
port
}
`
)
}
})
.
catch
((
err
)
=>
{
console
.
error
(
err
)
process
.
exit
(
1
)
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment