[英]webpack running with different errors on npm install
when I run npm install
or npm ci
that seems to trigger a webpack build which produces tons of incorrect errors.当我运行
npm install
或npm ci
时,这似乎触发了 webpack 构建,这会产生大量不正确的错误。 All of them referring to not found dependencies which are definitely there.所有这些都指的是肯定存在的未找到的依赖项。 In addition,
npm ci
seems to trigger even more of these errors than npm install
does.此外,
npm ci
似乎比npm install
触发的这些错误更多。
When I run webpack build, the build runs just fine however.当我运行 webpack 构建时,构建运行得很好。 I am quite surprised by that behaviour as I don't seem to find any documentation on what's triggering this webpack run.
我对这种行为感到非常惊讶,因为我似乎没有找到任何关于触发此 webpack 运行的文档。
I'd like to better understand:我想更好地理解:
npm install
?npm install
期间触发 webpack ? (I would very much just like that to install dependencies) I have installed:我已经安装了:
Sample error output looks like this:示例错误 output 如下所示:
matthias@daiquiri:~/dev/hamster-books$ npm ci
asset main.js 42.9 KiB [emitted] (name: main)
asset index.html 2.91 KiB [emitted]
cached modules 3.96 KiB [cached] 4 modules
code generated modules 9.58 KiB [code generated]
modules by path ./app/js/ui/ 6.5 KiB
modules by path ./app/js/ui/*.js 1.45 KiB
./app/js/ui/loadingDialog.js 177 bytes [code generated]
./app/js/ui/ui.js 1.27 KiB [code generated]
modules by path ./app/js/ui/_impl/*.js 5.05 KiB
./app/js/ui/_impl/createElement.js 480 bytes [code generated]
./app/js/ui/_impl/uiElementFactory.js 4.59 KiB [code generated]
modules by path ./app/js/*.js 3.08 KiB
./app/js/hamstersBooks.js 629 bytes [code generated]
./app/js/dispatcher.js 2.47 KiB [code generated]
./node_modules/xdate/src/xdate.js 19.5 KiB [built]
LOG from webpack.FileSystemInfo
<w> Managed item /home/matthias/dev/hamster-books/node_modules/html-webpack-plugin isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> Managed item /home/matthias/dev/hamster-books/node_modules/style-loader isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> Managed item /home/matthias/dev/hamster-books/node_modules/css-loader isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> Managed item /home/matthias/dev/hamster-books/node_modules/less-loader isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> Managed item /home/matthias/dev/hamster-books/node_modules/xdate isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> Managed item /home/matthias/dev/hamster-books/node_modules/ts-loader isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
+ 19 hidden lines
ERROR in ./app/js/dispatcher.js 2:32-75
Module not found: Error: Can't resolve 'ts-loader' in '/home/matthias/dev/hamster-books'
@ ./app/js/hamstersBooks.js 1:17-40
ERROR in ./app/js/dispatcher.js 3:40-69
Module not found: Error: Can't resolve 'ts-loader' in '/home/matthias/dev/hamster-books'
@ ./app/js/hamstersBooks.js 1:17-40
ERROR in ./app/js/dispatcher.js 4:34-81
Module not found: Error: Can't resolve 'ts-loader' in '/home/matthias/dev/hamster-books'
@ ./app/js/hamstersBooks.js 1:17-40
The output continues for a while after that, it's also repeating, trying to run webpack several times.I also checked - all these directories and files that are being referenced exist. output 在那之后持续了一段时间,它也在重复,试图运行 webpack 几次。我也检查了 - 所有这些被引用的目录和文件都存在。 It turns out some of them are coming from
node_modules
while other ones are just regular project references事实证明,其中一些来自
node_modules
而其他只是常规项目引用
Wipe node_modules
and reinstall.擦除
node_modules
并重新安装。 The reason for doing so is basically what @Harshal Patil comment is all about, ie conflicts after packages trigger their install/postinstall scripts.这样做的原因基本上是@Harshal Patil 评论的全部内容,即包触发其安装/安装后脚本后的冲突。
(This was the suggestion made in my comment, which solved the problem, now as answer so that it might be helpful for someone else with a similar issue) (这是我在评论中提出的建议,它解决了问题,现在作为答案,以便可能对其有类似问题的其他人有所帮助)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.