Skip to content

Commit 6a33456

Browse files
authored
Merge pull request #815 from netlify/feat/add-dep-error-message
Improve error message when dependencies installation fails
2 parents ba5481f + 923967b commit 6a33456

File tree

25 files changed

+11
-84
lines changed

25 files changed

+11
-84
lines changed

packages/build/src/plugins/options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const resolvePlugin = async function({ package, ...pluginOptions }, baseDir) {
4040
// `resolve`
4141
} catch (error) {
4242
logResolveError(error, package)
43-
await addDependency(package, { packageRoot: baseDir, stdio: 'ignore' })
43+
await addDependency(package, { packageRoot: baseDir })
4444
return await tryResolvePlugin(package, pluginOptions, baseDir)
4545
}
4646
}

packages/build/src/utils/install.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,16 @@ const installDependencies = async function(packageRoot) {
2020
}
2121

2222
// Add new Node.js dependencies
23-
const addDependency = async function(packageName, { packageRoot, stdio }) {
24-
await execa.command(`npm install --no-progress --no-audit --no-fund ${packageName}`, { cwd: packageRoot, stdio })
23+
const addDependency = async function(packageName, { packageRoot }) {
24+
try {
25+
await execa.command(`npm install --no-progress --no-audit --no-fund ${packageName}`, {
26+
cwd: packageRoot,
27+
all: true,
28+
})
29+
} catch (error) {
30+
const errorA = new Error(`Error while installing dependencies in ${packageRoot}\n${error.all}`)
31+
throw errorA
32+
}
2533
}
2634

2735
module.exports = { installDependencies, addDependency }
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/build/tests/config/validate/snapshots/tests.js.md

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -698,53 +698,6 @@ Generated by [AVA](https://ava.li).
698698
└─────────────────────────────┘␊
699699
`
700700

701-
## plugins.any.type renamed
702-
703-
> Snapshot 1
704-
705-
`␊
706-
> Starting Netlify Build v1.0.0␊
707-
https://github.com/netlify/build␊
708-
709-
> Flags␊
710-
{ config: '/file/path' }␊
711-
712-
> Current directory␊
713-
/file/path␊
714-
715-
> Config file␊
716-
/file/path␊
717-
718-
Configuration property plugins[0].type has been renamed to "package".␊
719-
720-
Invalid syntax␊
721-
722-
plugins:␊
723-
- type: /file/path␊
724-
725-
Valid syntax␊
726-
727-
plugins:␊
728-
- enabled: true␊
729-
package: /file/path␊
730-
731-
Error: '/file/path' plugin not installed or found.␊
732-
Please install it with npm or yarn.␊
733-
Cannot find module '/file/path' from '/file/path'␊
734-
735-
736-
┌─────────────────────────────┐␊
737-
│ Netlify Build Error │␊
738-
└─────────────────────────────┘␊
739-
740-
Error: Command failed with exit code 1: npm install --no-progress --no-audit --no-fund /file/path␊
741-
STACK TRACE␊
742-
743-
┌─────────────────────────────┐␊
744-
│ END Netlify Build Error │␊
745-
└─────────────────────────────┘␊
746-
`
747-
748701
## plugins.any: unknown property
749702

750703
> Snapshot 1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/build/tests/plugins/load/snapshots/tests.js.md

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -282,40 +282,6 @@ Generated by [AVA](https://ava.li).
282282
Have a nice day!␊
283283
`
284284

285-
## Missing plugins
286-
287-
> Snapshot 1
288-
289-
`␊
290-
> Starting Netlify Build v1.0.0␊
291-
https://github.com/netlify/build␊
292-
293-
> Flags␊
294-
{ config: '/file/path' }␊
295-
296-
> Current directory␊
297-
/file/path␊
298-
299-
> Config file␊
300-
/file/path␊
301-
302-
Error: 'does-not-exist' plugin not installed or found.␊
303-
Please install it with npm or yarn.␊
304-
Cannot find module 'does-not-exist' from '/file/path'␊
305-
306-
307-
┌─────────────────────────────┐␊
308-
│ Netlify Build Error │␊
309-
└─────────────────────────────┘␊
310-
311-
Error: Command failed with exit code 1: npm install --no-progress --no-audit --no-fund does-not-exist␊
312-
STACK TRACE␊
313-
314-
┌─────────────────────────────┐␊
315-
│ END Netlify Build Error │␊
316-
└─────────────────────────────┘␊
317-
`
318-
319285
## Node module plugins
320286

321287
> Snapshot 1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)