Today I tried to run webpack on my existing project and it failed with error described at the bottom.
I though that I did some mistake that broke webpack, but then I create new ASP.NET Core Angular 2 Starter Application (.NET Core). I install Template pack.
And I get the same error:
D:\OpPISWeb\trunk\OpPISWeb>webpack webpack.config.vendor.js
Hash: 685876a3a24b1c46b38273a3b1fc074a9d4b3f41
Version: webpack 1.14.0
Child
Hash: 685876a3a24b1c46b382
Version: webpack 1.14.0
Time: 20196ms
Asset Size Chunks Chunk Names
main.js 3.85 MB 0 [emitted] main
main-client.js 4.32 MB 1 [emitted] main-client
[0] ./webpack.config.vendor.js 2 kB {0} [built]
+ 910 hidden modulesWARNING in ./~/chokidar/lib/fsevents-handler.js Module not found: Error: Cannot resolve module 'fsevents' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\chokidar\lib @ ./~/chokidar/lib/fsevents-handler.js 7:17-36 ERROR in (webpack)/package.json Module parse failed: D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (2:9) at Parser.pp$4.raise (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:2221:15) at Parser.pp.unexpected (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:603:10) at Parser.pp.semicolon (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:966:10) at Parser.pp$1.parseStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:730:24) at Parser.pp$1.parseBlock (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:981:25) at Parser.pp$1.parseStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:709:33) at Parser.pp$1.parseTopLevel (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:638:25) at Parser.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:516:17) at Object.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:3098:39) at Parser.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\Parser.js:902:15) at DependenciesBlock.<anonymous> (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModule.js:104:16) at DependenciesBlock.onModuleBuild (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10) at nextLoader (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25) at D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5 at Storage.provide (D:\OpPISWeb\trunk\OpPISWeb\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:52:20) at CachedInputFileSystem.readFile (D:\OpPISWeb\trunk\OpPISWeb\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:140:24) at DependenciesBlock.onLoadPitchDone (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:255:7) at DependenciesBlock.loadPitch (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:182:27) at DependenciesBlock.doBuild (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:241:4) at DependenciesBlock.build (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModule.js:84:14) at Compilation.buildModule (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\Compilation.js:126:9) at D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\Compilation.js:309:10 at D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModuleFactory.js:58:13 at NormalModuleFactory.applyPluginsAsyncWaterfall (D:\OpPISWeb\trunk\OpPISWeb\node_modules\tapable\lib\Tapable.js:75:69) at onDoneResolving (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModuleFactory.js:38:11) at onDoneResolving (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModuleFactory.js:121:6) at D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModuleFactory.js:116:7 at D:\OpPISWeb\trunk\OpPISWeb\node_modules\async\lib\async.js:726:13 at D:\OpPISWeb\trunk\OpPISWeb\node_modules\async\lib\async.js:52:16 @ (webpack)/lib/Stats.js 139:16-42 ERROR in (webpack)/lib/node/NodeMainTemplateAsync.runtime.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\node @ (webpack)/lib/node/NodeMainTemplateAsync.runtime.js 9:2-15 24:2-15 ERROR in ./~/uglify-js/tools/node.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\uglify-js\tools @ ./~/uglify-js/tools/node.js 8:9-22 ERROR in (webpack)/lib/node/OldNodeWatchFileSystem.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\node @ (webpack)/lib/node/OldNodeWatchFileSystem.js 5:9-22 ERROR in (webpack)/lib/node/NodeOutputFileSystem.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\node @ (webpack)/lib/node/NodeOutputFileSystem.js 5:9-22 ERROR in ./~/mkdirp/index.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\mkdirp @ ./~/mkdirp/index.js 2:9-22 ERROR in ./~/graceful-fs/graceful-fs.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\graceful-fs @ ./~/graceful-fs/graceful-fs.js 1:9-22 ERROR in ./~/graceful-fs/fs.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\graceful-fs @ ./~/graceful-fs/fs.js 3:9-22 ERROR in ./~/constants-browserify/constants.json Module parse failed: D:\OpPISWeb\trunk\OpPISWeb\node_modules\constants-browserify\constants.json Unexpected token (2:12) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (2:12) at Parser.pp$4.raise (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:2221:15) at Parser.pp.unexpected (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:603:10) at Parser.pp.semicolon (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:966:10) at Parser.pp$1.parseStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:730:24) at Parser.pp$1.parseBlock (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:981:25) at Parser.pp$1.parseStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:709:33) at Parser.pp$1.parseTopLevel (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:638:25) at Parser.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:516:17) at Object.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:3098:39) at Parser.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\Parser.js:902:15) at DependenciesBlock.<anonymous> (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModule.js:104:16) at DependenciesBlock.onModuleBuild (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10) at nextLoader (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25) at D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5 at Storage.finished (D:\OpPISWeb\trunk\OpPISWeb\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16) at D:\OpPISWeb\trunk\OpPISWeb\node_modules\graceful-fs\graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:380:3) @ ./~/graceful-fs/polyfills.js 2:16-36 ERROR in ./~/chokidar/index.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\chokidar @ ./~/chokidar/index.js 3:9-22 ERROR in ./~/chokidar/lib/fsevents-handler.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\chokidar\lib @ ./~/chokidar/lib/fsevents-handler.js 3:9-22 ERROR in ./~/chokidar/lib/nodefs-handler.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\chokidar\lib @ ./~/chokidar/lib/nodefs-handler.js 3:9-22Child
Hash: 73a3b1fc074a9d4b3f41
Version: webpack 1.14.0
Time: 16754ms
Asset Size Chunks Chunk Names
main.js 10.3 kB 0 [emitted] main
main-server.js 347 kB 1 [emitted] main-server
[0] ./webpack.config.vendor.js 2 kB {0} [built]
+ 103 hidden modulesD:\OpPISWeb\trunk\OpPISWeb>
Can you verify the version of node / npm installed on your machine?
npm -v
node -v
Yes of course:
D:>node -v
v6.9.5D:>npm -v
3.10.10
Same happened on work computer. I really don't know what happened. It worked for month. _Great project by the way._
My mind cross an idea that one npm package released new version.
Edited:
My work setup:
D:>node -v
v4.4.7D:>npm -v
2.15.8
I just installed new project with yo generator and get almost same error.
Install:
? Framework Angular 2.4.5 (experimental)
? What type of project do you want to create? project.json (compatible with .NET Core tooling preview 2 and Visual Studio 2015)
? Do you want to include unit tests? No
? Your project name Angular
witch ends with success:
.........
Version: webpack 2.2.1
Child
Hash: b970f1bc52e5daae986b
Time: 7234ms
Asset Size Chunks Chunk Names
89889688147bd7575d6327160d64e760.svg 109 kB [emitted]
vendor.js 4.81 MB 0 [emitted] [big] vendor
vendor.css 315 kB 0 [emitted] [big] vendor
Child
Hash: 4fdc85a69922122c6835
Time: 6335ms
Asset Size Chunks Chunk Names
89889688147bd7575d6327160d64e760.svg 109 kB [emitted]
vendor.js 4.15 MB 0 [emitted] [big] vendor
Hash: 187ac61d7f223ddf909ea92d3d2b59b1dd584cf2
Version: webpack 2.2.1
Child
Hash: 187ac61d7f223ddf909e
Time: 4373ms
Asset Size Chunks Chunk Names
main-client.js 21.3 kB 0 [emitted] main-client
main-client.js.map 25 kB 0 [emitted] main-client
Child
Hash: a92d3d2b59b1dd584cf2
Time: 4363ms
Asset Size Chunks Chunk Names
main-server.js 149 kB 0 [emitted] main-server
Error:
D:\Temp\Angular>webpack webpack.config.vendor.js
Hash: 3b1720aa2ebe96244f56b25ac9c6c964b234f5e0
Version: webpack 2.2.1
Child
Hash: 3b1720aa2ebe96244f56
Time: 11026ms
Asset Size Chunks Chunk Names
main.js 2.48 MB 0 [emitted] [big] main
main-client.js 21.4 kB 1 [emitted] main-client
main.js.map 3.17 MB 0 [emitted] main
main-client.js.map 25 kB 1 [emitted] main-clientWARNING in ./~/chokidar/lib/fsevents-handler.js Module not found: Error: Can't resolve 'fsevents' in 'D:\Temp\Angular\node_modules\chokidar\lib' @ ./~/chokidar/lib/fsevents-handler.js 7:17-36 @ ./~/chokidar/index.js @ ./~/watchpack/lib/DirectoryWatcher.js @ ./~/watchpack/lib/watcherManager.js @ ./~/watchpack/lib/watchpack.js @ (webpack)/lib/node/NodeWatchFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js WARNING in ./~/ajv/lib/async.js 96:20-33 Critical dependency: the request of a dependency is an expression WARNING in ./~/ajv/lib/async.js 119:15-28 Critical dependency: the request of a dependency is an expression WARNING in ./~/ajv/lib/compile/index.js 13:21-34 Critical dependency: the request of a dependency is an expression WARNING in ./~/loader-runner/lib/loadLoader.js 3:2-28 Critical dependency: the request of a dependency is an expression ERROR in ./~/extract-text-webpack-plugin/index.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\extract-text-webpack-plugin' @ ./~/extract-text-webpack-plugin/index.js 5:9-22 @ ./webpack.config.vendor.js ERROR in ./~/extract-text-webpack-plugin/loader.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\extract-text-webpack-plugin' @ ./~/extract-text-webpack-plugin/loader.js 5:9-22 @ ./~/extract-text-webpack-plugin/index.js @ ./webpack.config.vendor.js ERROR in (webpack)/lib/NormalModule.js Module not found: Error: Can't resolve 'module' in 'D:\Temp\Angular\node_modules\webpack\lib' @ (webpack)/lib/NormalModule.js 94:16-33 @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in (webpack)/lib/node/NodeMainTemplateAsync.runtime.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\webpack\lib\node' @ (webpack)/lib/node/NodeMainTemplateAsync.runtime.js 9:2-15 25:3-16 @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in (webpack)/lib/node/NodeOutputFileSystem.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\webpack\lib\node' @ (webpack)/lib/node/NodeOutputFileSystem.js 5:9-22 @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/mkdirp/index.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\mkdirp' @ ./~/mkdirp/index.js 2:9-22 @ (webpack)/lib/node/NodeOutputFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/loader-runner/lib/LoaderRunner.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\loader-runner\lib' @ ./~/loader-runner/lib/LoaderRunner.js 5:9-22 @ (webpack)/lib/NormalModule.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/graceful-fs/graceful-fs.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\graceful-fs' @ ./~/graceful-fs/graceful-fs.js 1:9-22 @ ./~/enhanced-resolve/lib/NodeJsInputFileSystem.js @ (webpack)/lib/node/NodeEnvironmentPlugin.js @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/uglify-js/tools/node.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\uglify-js\tools' @ ./~/uglify-js/tools/node.js 8:9-22 @ (webpack)/lib/optimize/UglifyJsPlugin.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/graceful-fs/fs.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\graceful-fs' @ ./~/graceful-fs/fs.js 3:9-22 @ ./~/graceful-fs/graceful-fs.js @ ./~/enhanced-resolve/lib/NodeJsInputFileSystem.js @ (webpack)/lib/node/NodeEnvironmentPlugin.js @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/chokidar/index.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\chokidar' @ ./~/chokidar/index.js 3:9-22 @ ./~/watchpack/lib/DirectoryWatcher.js @ ./~/watchpack/lib/watcherManager.js @ ./~/watchpack/lib/watchpack.js @ (webpack)/lib/node/NodeWatchFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/chokidar/lib/fsevents-handler.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\chokidar\lib' @ ./~/chokidar/lib/fsevents-handler.js 3:9-22 @ ./~/chokidar/index.js @ ./~/watchpack/lib/DirectoryWatcher.js @ ./~/watchpack/lib/watcherManager.js @ ./~/watchpack/lib/watchpack.js @ (webpack)/lib/node/NodeWatchFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/chokidar/lib/nodefs-handler.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\chokidar\lib' @ ./~/chokidar/lib/nodefs-handler.js 3:9-22 @ ./~/chokidar/index.js @ ./~/watchpack/lib/DirectoryWatcher.js @ ./~/watchpack/lib/watcherManager.js @ ./~/watchpack/lib/watchpack.js @ (webpack)/lib/node/NodeWatchFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.jsChild
Hash: b25ac9c6c964b234f5e0
Time: 11022ms
Asset Size Chunks Chunk Names
main.js 7.99 MB 0 [emitted] [big] main
main-server.js 150 kB 1 [emitted] main-serverWARNING in ./~/chokidar/lib/fsevents-handler.js Module not found: Error: Can't resolve 'fsevents' in 'D:\Temp\Angular\node_modules\chokidar\lib' @ ./~/chokidar/lib/fsevents-handler.js 7:17-36 @ ./~/chokidar/index.js @ ./~/watchpack/lib/DirectoryWatcher.js @ ./~/watchpack/lib/watcherManager.js @ ./~/watchpack/lib/watchpack.js @ (webpack)/lib/node/NodeWatchFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js WARNING in ./~/ajv/lib/async.js 96:20-33 Critical dependency: the request of a dependency is an expression WARNING in ./~/ajv/lib/async.js 119:15-28 Critical dependency: the request of a dependency is an expression WARNING in ./~/ajv/lib/compile/index.js 13:21-34 Critical dependency: the request of a dependency is an expression WARNING in ./~/loader-runner/lib/loadLoader.js 3:2-28 Critical dependency: the request of a dependency is an expressionD:\Temp\Angular>
Hope it helps.
@MaklaCof The problem is on your work machine?
You need npm 3+, I'm guessing errors are coming from there.
Can you update to the latest Node (7.5.0 at the moment I believe) that'll update your npm and you should be all set.
Same problem. I tried on both projects (from VS template pack and on YO generated project).
Error in YO:
D:\Temp\Angular>node -v
v7.5.0D:\Temp\Angular>npm -v
4.1.2D:\Temp\Angular>webpack webpack.config.vendor.js
Hash: 3b1720aa2ebe96244f56b25ac9c6c964b234f5e0
Version: webpack 2.2.1
Child
Hash: 3b1720aa2ebe96244f56
Time: 10230ms
Asset Size Chunks Chunk Names
main.js 2.48 MB 0 [emitted] [big] main
main-client.js 21.4 kB 1 [emitted] main-client
main.js.map 3.17 MB 0 [emitted] main
main-client.js.map 25 kB 1 [emitted] main-clientWARNING in ./~/chokidar/lib/fsevents-handler.js Module not found: Error: Can't resolve 'fsevents' in 'D:\Temp\Angular\node_modules\chokidar\lib' @ ./~/chokidar/lib/fsevents-handler.js 7:17-36 @ ./~/chokidar/index.js @ ./~/watchpack/lib/DirectoryWatcher.js @ ./~/watchpack/lib/watcherManager.js @ ./~/watchpack/lib/watchpack.js @ (webpack)/lib/node/NodeWatchFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js WARNING in ./~/ajv/lib/async.js 96:20-33 Critical dependency: the request of a dependency is an expression WARNING in ./~/ajv/lib/async.js 119:15-28 Critical dependency: the request of a dependency is an expression WARNING in ./~/ajv/lib/compile/index.js 13:21-34 Critical dependency: the request of a dependency is an expression WARNING in ./~/loader-runner/lib/loadLoader.js 3:2-28 Critical dependency: the request of a dependency is an expression ERROR in ./~/extract-text-webpack-plugin/index.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\extract-text-webpack-plugin' @ ./~/extract-text-webpack-plugin/index.js 5:9-22 @ ./webpack.config.vendor.js ERROR in ./~/extract-text-webpack-plugin/loader.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\extract-text-webpack-plugin' @ ./~/extract-text-webpack-plugin/loader.js 5:9-22 @ ./~/extract-text-webpack-plugin/index.js @ ./webpack.config.vendor.js ERROR in (webpack)/lib/NormalModule.js Module not found: Error: Can't resolve 'module' in 'D:\Temp\Angular\node_modules\webpack\lib' @ (webpack)/lib/NormalModule.js 94:16-33 @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in (webpack)/lib/node/NodeMainTemplateAsync.runtime.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\webpack\lib\node' @ (webpack)/lib/node/NodeMainTemplateAsync.runtime.js 9:2-15 25:3-16 @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in (webpack)/lib/node/NodeOutputFileSystem.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\webpack\lib\node' @ (webpack)/lib/node/NodeOutputFileSystem.js 5:9-22 @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/mkdirp/index.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\mkdirp' @ ./~/mkdirp/index.js 2:9-22 @ (webpack)/lib/node/NodeOutputFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/loader-runner/lib/LoaderRunner.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\loader-runner\lib' @ ./~/loader-runner/lib/LoaderRunner.js 5:9-22 @ (webpack)/lib/NormalModule.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/graceful-fs/graceful-fs.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\graceful-fs' @ ./~/graceful-fs/graceful-fs.js 1:9-22 @ ./~/enhanced-resolve/lib/NodeJsInputFileSystem.js @ (webpack)/lib/node/NodeEnvironmentPlugin.js @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/uglify-js/tools/node.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\uglify-js\tools' @ ./~/uglify-js/tools/node.js 8:9-22 @ (webpack)/lib/optimize/UglifyJsPlugin.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/graceful-fs/fs.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\graceful-fs' @ ./~/graceful-fs/fs.js 3:9-22 @ ./~/graceful-fs/graceful-fs.js @ ./~/enhanced-resolve/lib/NodeJsInputFileSystem.js @ (webpack)/lib/node/NodeEnvironmentPlugin.js @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/chokidar/index.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\chokidar' @ ./~/chokidar/index.js 3:9-22 @ ./~/watchpack/lib/DirectoryWatcher.js @ ./~/watchpack/lib/watcherManager.js @ ./~/watchpack/lib/watchpack.js @ (webpack)/lib/node/NodeWatchFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/chokidar/lib/nodefs-handler.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\chokidar\lib' @ ./~/chokidar/lib/nodefs-handler.js 3:9-22 @ ./~/chokidar/index.js @ ./~/watchpack/lib/DirectoryWatcher.js @ ./~/watchpack/lib/watcherManager.js @ ./~/watchpack/lib/watchpack.js @ (webpack)/lib/node/NodeWatchFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js ERROR in ./~/chokidar/lib/fsevents-handler.js Module not found: Error: Can't resolve 'fs' in 'D:\Temp\Angular\node_modules\chokidar\lib' @ ./~/chokidar/lib/fsevents-handler.js 3:9-22 @ ./~/chokidar/index.js @ ./~/watchpack/lib/DirectoryWatcher.js @ ./~/watchpack/lib/watcherManager.js @ ./~/watchpack/lib/watchpack.js @ (webpack)/lib/node/NodeWatchFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.jsChild
Hash: b25ac9c6c964b234f5e0
Time: 10228ms
Asset Size Chunks Chunk Names
main.js 7.99 MB 0 [emitted] [big] main
main-server.js 150 kB 1 [emitted] main-serverWARNING in ./~/chokidar/lib/fsevents-handler.js Module not found: Error: Can't resolve 'fsevents' in 'D:\Temp\Angular\node_modules\chokidar\lib' @ ./~/chokidar/lib/fsevents-handler.js 7:17-36 @ ./~/chokidar/index.js @ ./~/watchpack/lib/DirectoryWatcher.js @ ./~/watchpack/lib/watcherManager.js @ ./~/watchpack/lib/watchpack.js @ (webpack)/lib/node/NodeWatchFileSystem.js @ (webpack)/lib ^.*$ @ (webpack)/lib/webpack.js @ ./webpack.config.vendor.js WARNING in ./~/ajv/lib/async.js 96:20-33 Critical dependency: the request of a dependency is an expression WARNING in ./~/ajv/lib/async.js 119:15-28 Critical dependency: the request of a dependency is an expression WARNING in ./~/ajv/lib/compile/index.js 13:21-34 Critical dependency: the request of a dependency is an expression WARNING in ./~/loader-runner/lib/loadLoader.js 3:2-28 Critical dependency: the request of a dependency is an expressionD:\Temp\Angular>
Old project:
D:\OpPISWeb\trunk\OpPISWeb>webpack webpack.config.vendor.js
Hash: 491ad1337d624a78e0c248c8ae6432a32d7c1240
Version: webpack 1.14.0
Child
Hash: 491ad1337d624a78e0c2
Version: webpack 1.14.0
Time: 16901ms
Asset Size Chunks Chunk Names
main.js 3.86 MB 0 [emitted] main
main-client.js 4.29 MB 1 [emitted] main-client
[0] ./webpack.config.vendor.js 2.04 kB {0} [built]
+ 910 hidden modulesWARNING in ./~/chokidar/lib/fsevents-handler.js Module not found: Error: Cannot resolve module 'fsevents' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\chokidar\lib @ ./~/chokidar/lib/fsevents-handler.js 7:17-36 ERROR in (webpack)/package.json Module parse failed: D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\package.json Unexpected token (2:9) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (2:9) at Parser.pp$4.raise (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:2221:15) at Parser.pp.unexpected (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:603:10) at Parser.pp.semicolon (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:966:10) at Parser.pp$1.parseStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:730:24) at Parser.pp$1.parseBlock (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:981:25) at Parser.pp$1.parseStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:709:33) at Parser.pp$1.parseTopLevel (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:638:25) at Parser.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:516:17) at Object.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:3098:39) at Parser.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\Parser.js:902:15) at NormalModule.<anonymous> (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModule.js:104:16) at NormalModule.onModuleBuild (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10) at nextLoader (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25) at D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5 at Storage.provide (D:\OpPISWeb\trunk\OpPISWeb\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:52:20) at CachedInputFileSystem.readFile (D:\OpPISWeb\trunk\OpPISWeb\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:140:24) at NormalModule.onLoadPitchDone (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:255:7) at NormalModule.loadPitch (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:182:27) at NormalModule.doBuild (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:241:4) at NormalModule.build (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModule.js:84:14) at Compilation.buildModule (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\Compilation.js:126:9) at D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\Compilation.js:309:10 at D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModuleFactory.js:58:13 at NormalModuleFactory.applyPluginsAsyncWaterfall (D:\OpPISWeb\trunk\OpPISWeb\node_modules\tapable\lib\Tapable.js:75:69) at onDoneResolving (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModuleFactory.js:38:11) at onDoneResolving (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModuleFactory.js:121:6) at D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModuleFactory.js:116:7 at D:\OpPISWeb\trunk\OpPISWeb\node_modules\async\lib\async.js:726:13 at D:\OpPISWeb\trunk\OpPISWeb\node_modules\async\lib\async.js:52:16 @ (webpack)/lib/Stats.js 139:16-42 ERROR in (webpack)/lib/node/NodeMainTemplateAsync.runtime.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\node @ (webpack)/lib/node/NodeMainTemplateAsync.runtime.js 9:2-15 24:2-15 ERROR in ./~/uglify-js/tools/node.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\uglify-js\tools @ ./~/uglify-js/tools/node.js 8:9-22 ERROR in (webpack)/lib/node/NodeOutputFileSystem.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\node @ (webpack)/lib/node/NodeOutputFileSystem.js 5:9-22 ERROR in (webpack)/lib/node/OldNodeWatchFileSystem.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\node @ (webpack)/lib/node/OldNodeWatchFileSystem.js 5:9-22 ERROR in ./~/mkdirp/index.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\mkdirp @ ./~/mkdirp/index.js 2:9-22 ERROR in ./~/graceful-fs/graceful-fs.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\graceful-fs @ ./~/graceful-fs/graceful-fs.js 1:9-22 ERROR in ./~/graceful-fs/fs.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\graceful-fs @ ./~/graceful-fs/fs.js 3:9-22 ERROR in ./~/constants-browserify/constants.json Module parse failed: D:\OpPISWeb\trunk\OpPISWeb\node_modules\constants-browserify\constants.json Unexpected token (2:12) You may need an appropriate loader to handle this file type. SyntaxError: Unexpected token (2:12) at Parser.pp$4.raise (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:2221:15) at Parser.pp.unexpected (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:603:10) at Parser.pp.semicolon (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:581:61) at Parser.pp$1.parseExpressionStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:966:10) at Parser.pp$1.parseStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:730:24) at Parser.pp$1.parseBlock (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:981:25) at Parser.pp$1.parseStatement (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:709:33) at Parser.pp$1.parseTopLevel (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:638:25) at Parser.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:516:17) at Object.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\acorn\dist\acorn.js:3098:39) at Parser.parse (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\Parser.js:902:15) at NormalModule.<anonymous> (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack\lib\NormalModule.js:104:16) at NormalModule.onModuleBuild (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10) at nextLoader (D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25) at D:\OpPISWeb\trunk\OpPISWeb\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5 at Storage.finished (D:\OpPISWeb\trunk\OpPISWeb\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16) at D:\OpPISWeb\trunk\OpPISWeb\node_modules\graceful-fs\graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:416:3) @ ./~/graceful-fs/polyfills.js 2:16-36 ERROR in ./~/chokidar/index.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\chokidar @ ./~/chokidar/index.js 3:9-22 ERROR in ./~/chokidar/lib/nodefs-handler.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\chokidar\lib @ ./~/chokidar/lib/nodefs-handler.js 3:9-22 ERROR in ./~/chokidar/lib/fsevents-handler.js Module not found: Error: Cannot resolve module 'fs' in D:\OpPISWeb\trunk\OpPISWeb\node_modules\chokidar\lib @ ./~/chokidar/lib/fsevents-handler.js 3:9-22Child
Hash: 48c8ae6432a32d7c1240
Version: webpack 1.14.0
Time: 14316ms
Asset Size Chunks Chunk Names
main.js 10.4 kB 0 [emitted] main
main-server.js 347 kB 1 [emitted] main-server
[0] ./webpack.config.vendor.js 2.04 kB {0} [built]
+ 103 hidden modulesD:\OpPISWeb\trunk\OpPISWeb>
I will also try on another (work) computer.
Same on work computer.
I will also try on another windows with VS2017 which has 1 week old installation.
Hi. Have you tried running it like webpack --config webpack.config.vendor.js?
I added three helpers to assist with managing vendors on our project.
"generateVendors" : Generates vendors when dependencies are added, updated or removed. It also does the initial vendor creation.
"hardreset": Complete reset and clear of all possible cached node modules and build output. This is run when we experience the odd NPM issue. This also generates the vendors again.
You will need to add rimraf to your devDependencies to make use of the above.
{
"name": "Angular2SPA",
"version": "0.0.0",
"scripts": {
"test": "karma start ClientApp/test/karma.conf.js",
"generateVendors": "webpack --config webpack.config.vendor.js && webpack",
"publish": "dotnet publish",
"hardreset": "rimraf \"./node/modules/\" && rimraf \"./bin/\" && rimraf \"./obj/\" && dotnet restore && npm install && npm run-script generateVendors && dotnet build"
},
I should really start reading my own comments:
/*
When changing this file run webpack --config webpack.config.vendor.js in command promt
*/
I really really apologise everyone for taking your precious time.
I forget to add --config. In the past I always use copy paste from readme file. But now I manually write "wrong" command.
Again, please execuse me.
And thank you for your help.
I'm new to the dotnet 2.0 angular template world. What file should this ix go into mentioned above? I have a project that I'm trying to add third party .css and .js files to and can't find documentation for it.
Thanks in advance.
Currently I am using this template.
I do not know anything about JavascriptServices template.
@Indyy66: generateVendors": "node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js && node node_modules/webpack/bin/webpack.js"
Ok, I found the webpack.config.vendors.js file. Whta I want to know is where to place my custom .css and .js files so that the webpack should pick them up? Should they be in the dist folder under wwwroot or the one under the ClientApp folder?
On "dotnet watch run" I was getting:
WARNING in ./~//.es5.js
5704:15-36 Critical dependency: the request of a dependency is an expression
WARNING in ./~//.es5.js
5720:15-102 Critical dependency: the request of a dependency is an expression
Resolved by "plugins" in webpack.config.vendor.js looking like this:
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/11580
// new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, path.join(__dirname, './ClientApp')), // Workaround for https://github.com/angular/angular/issues/14898
new webpack.ContextReplacementPlugin(
// if you have anymore problems tweet me at @gdi2290
// The (\\|\/) piece accounts for path separators for Windows and MacOS
/(.+)?angular(\\|\/)core(.+)?/,
path.join(__dirname, './ClientApp'), // location of your src
{} // a map of your routes
), //https://github.com/angular/angular/issues/11580#issuecomment-282705332 gdi2290 6 Sep
new webpack.IgnorePlugin(/^vertx$/) // Workaround for https://github.com/stefanpenner/es6-promise/
Most helpful comment
Hi. Have you tried running it like
webpack --config webpack.config.vendor.js?