Hello,
as many people probably noticed, there is issue when running meteor using npm run.
That means that you prepare scripts in package.json so the simple command run meteor with many arguments and you does not have to write it all by hand every time.
But seems current node I/O streams are somehow not compatible with meteor’s internal node I/O.
So it end up with like 170% of constant CPU consumption by node on my 4 core.
For this you you need to use older node to call that npm
.
That can be done by installing nvm
and switching to old node version.
As we need to run also chimp and I would prefer still to use current npm version by default so I prepared little wrapper for brew installed nvm on my OSX.
Roberts-MacBook-Pro:~ shock$ cat .bash_profile
export NVM_DIR=~/.nvm
. /usr/local/opt/nvm/nvm.sh
alias npm="~/.npm_wrapper.sh"
Roberts-MacBook-Pro:~ shock$ cat .npm_wrapper.sh
#!/bin/bash
readonly METEOR_NODE_VERSION="0.10.40"
# source nvm script installed by brew
. /usr/local/opt/nvm/nvm.sh
if [[ "$1" == "run" && ( "$2" == "start" || "$2" == "testEnv" ) ]]
then
echo "Using npm for $METEOR_NODE_VERSION"
nodePath=$(nvm which $METEOR_NODE_VERSION)
npmPath=$(echo $nodePath | sed 's/node$/npm/')
exec "$npmPath" $@
else
# exec with current node
nodePath=$(nvm which current)
npmPath=$(echo $nodePath | sed 's/node$/npm/')
exec "$npmPath" $@
fi
echo "Something went horribly wrong in npm_wrapper.sh"
exit 1
Link to meteor issue https://github.com/meteor/meteor/issues/4314
Bye