Skip to content
Snippets Groups Projects
Commit 68f94f49 authored by Bob Mottram's avatar Bob Mottram
Browse files

Handle image install of global node modules directory

parent 88b9907f
No related branches found
No related tags found
No related merge requests found
......@@ -204,18 +204,20 @@ function nodejs_upgrade {
}
function nodejs_setup_global_modules {
if [ ! -d /root/.npm-global ]; then
mkdir /root/.npm-global
if [ ! -d "$rootdir/root/.npm-global" ]; then
mkdir "$rootdir/root/.npm-global"
fi
npm config set prefix '/root/.npm-global'
export PATH=/root/.npm-global/bin:$PATH
if ! grep -q "PATH=/root/.npm-global/bin" /root/.bashrc; then
echo "PATH=/root/.npm-global/bin:\$PATH" >> /root/.bashrc
$mesh_install_nodejs_prefix npm config set prefix '/root/.npm-global'
if ! grep -q "PATH=/root/.npm-global/bin" "$rootdir/root/.bashrc"; then
echo "PATH=/root/.npm-global/bin:\$PATH" >> "$rootdir/root/.bashrc"
fi
if ! grep -q "NPM_CONFIG_PREFIX=" /root/.bashrc; then
echo "export NPM_CONFIG_PREFIX=/root/.npm-global" >> /root/.bashrc
if ! grep -q "NPM_CONFIG_PREFIX=" "$rootdir/root/.bashrc"; then
echo "export NPM_CONFIG_PREFIX=/root/.npm-global" >> "$rootdir/root/.bashrc"
fi
if [ ! "$rootdir" ]; then
export PATH=/root/.npm-global/bin:$PATH
export NPM_CONFIG_PREFIX=/root/.npm-global
fi
export NPM_CONFIG_PREFIX=/root/.npm-global
}
function remove_nodejs {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment