How do I install npm on community cloud?

I am trying to install an npm package to use in my streamlit app (hosted on community cloud). However, the npm command is failing.

  1. npm package I want to install & use as a part of my app: GitHub - softwaretechnik-berlin/dbml-renderer
  2. My streamlit app:
  3. Error Message:
File "/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/", line 534, in _run_script
    exec(code, module.__dict__)File "/mount/src/mvp-streamlit-local/", line 21, in <module>
    install_npm()File "/mount/src/mvp-streamlit-local/", line 30, in install_npm["npm", "install", "-g", "@softwaretechnik/dbml-renderer"])File "/usr/local/lib/python3.9/", line 505, in run
    with Popen(*popenargs, **kwargs) as process:File "/usr/local/lib/python3.9/", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,File "/usr/local/lib/python3.9/", line 1837, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)

Hi @anushkasingh98

Have you installed nodejs, which you can do by specifying it in the packages.txt file (this will allow the OS to install it)

Yes, I have specified nodejs in the packages.txt file. After having nodejs installed, I am getting the following error when I run the line :[“npm”, “install”, “-g”, “@softwaretechnik/dbml-renderer”])

npm ERR![2023-12-15 18:45:06.550252]  code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/appuser/.npm/_logs/2023-12-15T18_45_06_552Z-debug.log