PowerBI-visuals-tools: Error: Can't resolve 'process/browser'

When using 3.1.19 I’m getting the following error:

 ERROR  Failed to compile with 1 errors                                                                         11:17:18
 error  in ./node_modules/axios/lib/defaults.js

Module not found: Error: Can't resolve 'process/browser' in 'C:\Code\accoPLANNING\Visual\node_modules\axios\lib'

× 「wdm」: assets by status 4.58 MiB [cached] 6 assets
Entrypoint visual.js = visual.css visual.js 2 auxiliary assets
orphan modules 43.6 KiB [orphan] 29 modules
runtime modules 1.25 KiB 6 modules
modules by path ./node_modules/core-js/ 417 KiB 439 modules
modules by path ./node_modules/@microsoft/ 456 KiB 88 modules
modules by path ./node_modules/validatorjs/src/ 249 KiB 56 modules
modules by path ./node_modules/axios/ 41.2 KiB 27 modules
modules by path ./node_modules/@accobat/accotool.js/ 9.23 KiB 5 modules
modules by path ./node_modules/uuid/dist/esm-browser/*.js 3.24 KiB 5 modules
modules by path ./src/ 171 KiB 3 modules
modules by path ./node_modules/powerbi-visuals-utils-dataviewutils/lib/*.js 5.53 KiB 3 modules
css modules 274 KiB
  css ../../../Users/jip/AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/css-loader/dist/cjs.js!./node_modules/flexmonster/flexmonster.css 272 KiB [code generated]
  css ../../../Users/jip/AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/css-loader/dist/cjs.js!../../../Users/jip/AppData/Roaming/npm/node_modules/powerbi-visuals-tools/node_modules/less-loader/dist/cjs.js??ruleSet[1].rules[2].use[2]!./style/visual.less 2.27 KiB [code generated]
7 modules

ERROR in ./node_modules/axios/lib/defaults.js 23:20-27
Module not found: Error: Can't resolve 'process/browser' in 'C:\Code\accoPLANNING\Visual\node_modules\axios\lib'
resolve 'process/browser' in 'C:\Code\accoPLANNING\Visual\node_modules\axios\lib'
  Parsed request is a module
  using description file: C:\Code\accoPLANNING\Visual\node_modules\axios\package.json (relative path: ./lib)
    resolve as module
      C:\Code\accoPLANNING\Visual\node_modules\axios\lib\node_modules doesn't exist or is not a directory
      C:\Code\accoPLANNING\Visual\node_modules\axios\node_modules doesn't exist or is not a directory
      C:\Code\accoPLANNING\Visual\node_modules\node_modules doesn't exist or is not a directory
      looking for modules in C:\Code\accoPLANNING\Visual\node_modules
        C:\Code\accoPLANNING\Visual\node_modules\process doesn't exist
      C:\Code\accoPLANNING\node_modules doesn't exist or is not a directory
      C:\Code\node_modules doesn't exist or is not a directory
      C:\node_modules doesn't exist or is not a directory
    aliased with mapping 'process': 'C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\index.js' to 'C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\index.js/browser'
      using description file: C:\Code\accoPLANNING\Visual\node_modules\axios\package.json (relative path: ./lib)
        using description file: C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\package.json (relative path: ./index.js/browser)
          no extension
            Field 'browser' doesn't contain a valid alias configuration
            C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\index.js\browser doesn't exist
          .tsx
            Field 'browser' doesn't contain a valid alias configuration
            C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\index.js\browser.tsx doesn't exist
          .ts
            Field 'browser' doesn't contain a valid alias configuration
            C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\index.js\browser.ts doesn't exist
          .jsx
            Field 'browser' doesn't contain a valid alias configuration
            C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\index.js\browser.jsx doesn't exist
          .js
            Field 'browser' doesn't contain a valid alias configuration
            C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\index.js\browser.js doesn't exist
          .css
            Field 'browser' doesn't contain a valid alias configuration
            C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\index.js\browser.css doesn't exist
          as directory
            C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\index.js\browser doesn't exist
 @ ./node_modules/axios/lib/axios.js 11:15-36
 @ ./node_modules/axios/index.js 1:0-39
 @ ./src/visual.ts 358:0-26 2053:23-33
 @ ./.tmp/precompile/visualPlugin.ts 1:0-42 10:8-14 11:17-23

webpack 5.37.1 compiled with 1 error in 24908 ms
i 「wdm」: Failed to compile.
Watchpack Error (initial scan): Error: ENOTDIR: not a directory, scandir 'C:\Users\jip\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\node_modules\process\index.js'

Can you advice how to fix this?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 16
  • Comments: 23 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@andrewluetgers I also ran into this issue and finally resolved it by adding this to my webpck-config override - I am using react-app-rewired

config.module.rules.push({
      test: /\.m?js/,
      resolve: {
          fullySpecified: false
      }
  })

If you are using a non create-react-app set up you could just addd it to the webpack config like so:

module: {
    rules: [
       {
          test: /\.m?js/,
          resolve: {
              fullySpecified: false
          }
    ]
}

Hope that helps you!

@lucmax94 If you install process as a dev dependency this fixed the problem for me.

Use npm install --save-dev process.

@JipAccobat , so in that case I suppose that the reason of your issue is that now we use webpack version 5+ in powerbi-visuals-tools, and your project dependency lib of webpack is also updated, but starting from version 5 they removed polyfills for Node.js variables. So you need to modify your webpack config a little bit to make it work. Please read articles about migrating to webpack 5.

But as a quick tip, just try to define process in plugins section of your webpack.config.js

const webpack = require("webpack");
...
module.exports = {
...,
    plugins: [
        new webpack.ProvidePlugin({
            process: "process/browser"
        }), ...
    ]
};

@andrewluetgers I also ran into this issue and finally resolved it by adding this to my webpck-config override - I am using react-app-rewired

config.module.rules.push({
      test: /\.m?js/,
      resolve: {
          fullySpecified: false
      }
  })

If you are using a non create-react-app set up you could just addd it to the webpack config like so:

module: {
    rules: [
       {
          test: /\.m?js/,
          resolve: {
              fullySpecified: false
          }
    ]
}

Hope that helps you!

Thanks, that worked perfectly!!

@lucmax94 If you install process as a dev dependency this fixed the problem for me.

Use npm install --save-dev process.

I install this but never worked for me. I am not using webpack. image

Still getting the same error as above after upgrading to v3.2.3. I am not using webpack within my project but I tried to fix the error by adding webpack and adding the code from @Demonkratiy. Still getting the same error. Had to go back to v3.1.18.

const webpack = require("webpack");
...
module.exports = {
...,
    plugins: [
        new webpack.ProvidePlugin({
            process: "process/browser"
        }), ...
    ]
};

@lucmax94 If you install process as a dev dependency this fixed the problem for me.

Use npm install --save-dev process.

That worked, thanks!

Hi, I have a similar issue and none of the abobe works for me. Also I cant find Webpack.Config.js Here is my error could anyone help?

ERROR in visual.js Module not found: Error: Can’t resolve ‘C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView.tmp\build\visual.js’ in ‘C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView’
resolve ‘C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView.tmp\build\visual.js’ in ‘C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView’ using description file: C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView\package.json (relative path: .) Field ‘browser’ doesn’t contain a valid alias configuration using description file: C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView\package.json (relative path: ./.tmp/build/visual.js) no extension Field ‘browser’ doesn’t contain a valid alias configuration C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView.tmp\build\visual.js doesn’t exist .tsx Field ‘browser’ doesn’t contain a valid alias configuration C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView.tmp\build\visual.js.tsx doesn’t exist .ts Field ‘browser’ doesn’t contain a valid alias configuration C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView.tmp\build\visual.js.ts doesn’t exist .jsx Field ‘browser’ doesn’t contain a valid alias configuration C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView.tmp\build\visual.js.jsx doesn’t exist .js Field ‘browser’ doesn’t contain a valid alias configuration C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView.tmp\build\visual.js.js doesn’t exist .css Field ‘browser’ doesn’t contain a valid alias configuration C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView.tmp\build\visual.js.css doesn’t exist as directory C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView.tmp\build\visual.js doesn’t exist

webpack 5.74.0 compiled with 1 error in 268 ms Webpack Bundle Analyzer saved report to C:\Users\gjordan.SPOERERnet\source\repos\Forge2PowerBI\forgePowerbiView\webpack.statistics.dev.html assets by status 99 bytes [cached] 1 asset

@andrewluetgers I also ran into this issue and finally resolved it by adding this to my webpck-config override - I am using react-app-rewired

config.module.rules.push({
      test: /\.m?js/,
      resolve: {
          fullySpecified: false
      }
  })

If you are using a non create-react-app set up you could just addd it to the webpack config like so:

module: {
    rules: [
       {
          test: /\.m?js/,
          resolve: {
              fullySpecified: false
          }
    ]
}

Hope that helps you!

Perfect! I wanna hug you.

@JipAccobat @lucmax94 , hi folks! Do you still have this problem on latest version of tools? If so, than please can you tell me if you are using webpack in your projects?