Jupyter lab problem

I have been trying to install tensorflow, pytorch, jetson jupyter all together, but I am having trouble to get the jupyterlab working.
Most of the code I use is from this site: https://github.com/NVIDIA-AI-IOT/jetcard/blob/master/install.sh
The code I use is:

echo $password | sudo -S apt install -y nodejs npm
echo $password | sudo -S pip3 install -U jupyter jupyterlab==1.2.4
echo $password | sudo -S jupyter labextension install @jupyter-widgets/jupyterlab-manager
#echo $password | sudo -S jupyter labextension install @jupyterlab/statusbar
echo $password | sudo jupyter lab --generate-config
echo $password | sudo jupyter notebook password
#install jupyter clickable service
echo(“install jupyter clickable service”)
cd ~/AI
echo $password | sudo -S npm install -g typescript
git clone https://github.com/jaybdub/jupyter_clickable_image_widget
cd jupyter_clickable_image_widget

set +e #next command can fail
echo $password | sudo -S python3 setup.py build

set -e
echo $password | sudo -S npm run build
echo $password | sudo -S pip3 install .
echo $password | sudo -S jupyter labextension install .
echo $password | sudo -S jupyter labextension install @jupyter-widgets/jupyterlab-manager

The error I get trying to run jupyter notebook is:

xaviernx@xaviernx-desktop:~$ jupyter notebook
Traceback (most recent call last):
File “/usr/local/bin/jupyter-notebook”, line 8, in
sys.exit(main())
File “/usr/local/lib/python3.6/dist-packages/jupyter_core/application.py”, line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/traitlets/config/application.py”, line 663, in launch_instance
app.initialize(argv)
File “”, line 2, in initialize
File “/usr/local/lib/python3.6/dist-packages/traitlets/config/application.py”, line 87, in catch_config_error
return method(app, *args, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/notebook/notebookapp.py”, line 1761, in initialize
super(NotebookApp, self).initialize(argv)
File “”, line 2, in initialize
File “/usr/local/lib/python3.6/dist-packages/traitlets/config/application.py”, line 87, in catch_config_error
return method(app, *args, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/jupyter_core/application.py”, line 245, in initialize
self.migrate_config()
File “/usr/local/lib/python3.6/dist-packages/jupyter_core/application.py”, line 170, in migrate_config
migrate()
File “/usr/local/lib/python3.6/dist-packages/jupyter_core/migrate.py”, line 247, in migrate
with open(os.path.join(env[‘jupyter_config’], ‘migrated’), ‘w’) as f:
PermissionError: [Errno 13] Permission denied: ‘/home/xaviernx/.jupyter/migrated’

Please let me know if you see something wrong with my code.
Thank you,"
Luis Chachayma

I solved the issue:
I was executing the jupyter lab --generate-config command as root
you are not suppose to execute the command with root otherwise it will create the service just for root user.