简体   繁体   中英

NodeJS script - npm doesn't show current installed version on exec()

I have a simple script that runs inside /some/project/folder

the script goes like this:

exec("npm -v", (err, stdout, stderr) => {


        $log.info('version installed', stdout);


    });

Now, when i run this node script it outputs 3.10.9 but when i go inside the /some/project/folder (by the terminal) and i run npm -v manually, it outputs 3.3.6

**

How this could be?

**

I am using nvm all the way down, but i don't understand if it's a problem with that or not.

any advice ?

thanks

Sorry for wasting time, today it works i did not change anything so i don't know why yesterday no and today yes.

Crazy, thanks for your help anyway!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM