Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stefan7's avatar

Node modules are installed but are not found

Hi, I am running node.js on windows and am struggling now for hours with this error. I did install with npm install ... all this modules that seem to be missing. The module folders exist in Laravel project and I installed globally as well. What am I missing?

ERROR in ./node_modules/require-directory/index.js Module not found: Error: Can't resolve 'fs' in 'D:\Xampp\htdocs\project\node_modules require-directory'

ERROR in ./node_modules/spdx-expression-parse/scan.js Module not found: Error: Can't resolve 'spdx-license-ids/deprecated' in 'D:\Xampp \htdocs\project\node_modules\spdx-expression-parse' @ ./node_modules/spdx-expression-parse/scan.js 5:10-48

0 likes
3 replies
sumbria's avatar

Add the following to your Webpack config:

node: {
   fs: "empty"
}

And then add spdx-license-ids package via

npm install spdx-license-ids
stefan7's avatar

Thanks I have now less error messages. I tried to play around to add these packages to config like FS, but did not seem to work. I have still left although the packages exist in the folder:

ERROR in ./node_modules/spdx-expression-parse/scan.js Module not found: Error: Can't resolve 'spdx-exceptions' in 'D:\Xampp\htdocs\project node_modules\spdx-expression-parse'

ERROR in ./node_modules/spdx-expression-parse/scan.js Module not found: Error: Can't resolve 'spdx-exceptions' in 'D:\Xampp\htdocs\project node_modules\spdx-expression-parse'

ERROR in ./node_modules/spdx-expression-parse/scan.js Module not found: Error: Can't resolve 'spdx-license-ids' in 'D:\Xampp\htdocs\project \node_modules\spdx-expression-parse'

ERROR in ./node_modules/spdx-expression-parse/scan.js Module not found: Error: Can't resolve 'spdx-license-ids/deprecated' in 'D:\Xampp \htdocs\project\node_modules\spdx-expression-parse'

I have at the moment

mix.webpackConfig({
    node: {
        fs: "empty",
        node_child: "empty",
        child_process: "empty",
        spdx_expression_parse: "empty",
        spdx_exceptions: "empty",
    },
stefan7's avatar

Still having this issue, how can I solve this?

Please or to participate in this conversation.