Jlpm --verbose run build - Error: Cannot find module 'fs-extra'


When I try to build the dev mode assets for Jupyterlab, i.e., when I run the command jlpm --verbose run build, I face this error. I have tried everything I can to resolve this but I am unable to get through this.

Tried uninstalling and reinstalling Nodejs and npm as well. But no luck. Need help

jlpm run integrity && jlpm run build:vega && jlpm run build:packages && cd dev_mode && jlpm run build node buildutils/lib/ensure-repo.js
throw err;

Error: Cannot find module ‘fs-extra’
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/Users/c053794/workingdir/jupyterlab/buildutils/lib/utils.js:5:12)

Can you give step-by-step instructions to reproduce your setup in a clean environment? Please include versions of jupyterlab, node, etc.

For example, if you install things through conda, you can do conda create -n myenvironment jupyterlab=2 nodejs=13

I was able to find a solution and was able to fix the errors. Thank you for you reply :slight_smile:

Do you mind sharing what you did, in case others see similar issues and are looking for help?

So, when I was trying to run ‘jlpm --verbose run build’ command, I received a lot of errors like:

Cannot find module 'glob'
Error: Cannot find module 'glob'
Cannot find module 'fs-extra'
Error: Cannot find module 'fs-extra'
Cannot find module 'sort-package-json'
Error: Cannot find module 'sort-package-json'

And couple more. Initially what I did, I tried installing each of those modules using the below commands:

sudo npm install --save glob
sudo npm install --save fs-extra
sudo npm install --save dependency-graph
sudo npm install --save sort-package-json
sudo npm install --save @phosphor/coreutils
sudo npm install --save prettier
sudo npm install --save typescript

But everytime, I resolve one issue, a new package issue was found. So, I wanted to re-install all the missing packages. For that, I had to uninstall nodejs and npm and once I uninstalled and deleted all the files from my drives:

brew uninstall node
brew unlink node
brew unlink npm
brew unlink node_modules
rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp

I ran these commands:

brew install node
npm install yarn -g
npm install -g typescript
npm install
yarn install

That fixed all the issues