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
e763a608
Unverified
Commit
e763a608
authored
Sep 14, 2018
by
Tim Neutkens
Committed by
GitHub
Sep 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don’t read package.scripts if there’s no scripts defined (#5168)
parent
34cb05a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
next-dev
bin/next-dev
+9
-4
No files found.
bin/next-dev
View file @
e763a608
#!/usr/bin/env node
#!/usr/bin/env node
import
{
resolve
,
join
}
from
'path'
import
{
resolve
,
join
}
from
'path'
import
parseArgs
from
'minimist'
import
parseArgs
from
'minimist'
import
{
existsSync
,
readFileSync
}
from
'fs'
import
{
existsSync
}
from
'fs'
import
Server
from
'../server'
import
Server
from
'../server'
import
{
printAndExit
}
from
'../lib/utils'
import
{
printAndExit
}
from
'../lib/utils'
...
@@ -65,9 +65,14 @@ srv.start(argv.port, argv.hostname)
...
@@ -65,9 +65,14 @@ srv.start(argv.port, argv.hostname)
const
pkgAppPath
=
require
(
'find-up'
).
sync
(
'package.json'
,
{
const
pkgAppPath
=
require
(
'find-up'
).
sync
(
'package.json'
,
{
cwd
:
dir
cwd
:
dir
})
})
const
appPackage
=
JSON
.
parse
(
readFileSync
(
pkgAppPath
,
'utf8'
))
const
appPackage
=
require
(
pkgAppPath
)
const
nextScript
=
Object
.
entries
(
appPackage
.
scripts
).
find
(
scriptLine
=>
scriptLine
[
1
]
===
'next'
)
if
(
appPackage
.
scripts
)
{
if
(
nextScript
)
errorMessage
+=
`\nUse \`npm run
${
nextScript
[
0
]}
-- -p <some other port>\`.`
const
nextScript
=
Object
.
entries
(
appPackage
.
scripts
).
find
(
scriptLine
=>
scriptLine
[
1
]
===
'next'
)
if
(
nextScript
)
{
errorMessage
+=
`\nUse \`npm run
${
nextScript
[
0
]}
-- -p <some other port>\`.`
}
}
console
.
error
(
errorMessage
)
console
.
error
(
errorMessage
)
}
else
{
}
else
{
console
.
error
(
err
)
console
.
error
(
err
)
...
...
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