I am running a javascript project which runs version node version 16. However, when I run the project it is attempting to build the project with version 12. I have used a find and removed every version of node globally and I also pruned the cache. I have removed every reference to node other than version 16, yet when I run the project it still looks for version 12. I am at my wits end as I really don't know where else the node command cli is finding node version 12. Every hidden .npm etc node packages have been removed but clearly it is attempting to use version 12. How is it determining it needs version 12? Please help as I cannot run the project which really needs version 16.
-
you've failed to mention what operating system you are running, nor how you are "building" the project – Jaromanda X May 09 '23 at 03:21
-
I'm sorry I am running on a mac os Ventura – BreenDeen May 09 '23 at 03:53
-
`... nor how you are "building" the project` – Jaromanda X May 09 '23 at 04:29
-
You say "it looks for version 12". Does it find it? In other words, is the problem that you are somehow running Node.js 12 but you have no idea where it is, or is the problem that your project wants version 12 and you don't want it to want version 12? – Trott May 09 '23 at 18:42
-
HOW are you running the project? `nvm ls` what versions are installed? Set the default. – epascarello May 09 '23 at 18:49
-
Here is how I start the project: "start": "ts-node --experimentalSpecifierResolution node ./index.ts", – BreenDeen May 11 '23 at 19:57
2 Answers
since your Question is not specifiying your environment there are several possible answers:
If you are using NodeJS from a terminal like windows cmd or linux shell
It's important to look at your PATH-variables. In both Linux and Windows surroundings its important to have a PATH variable like this /path/to/node-installation/bin
Have a look here: How to Change PATH under Linux
Its important to have an entry in the PATH-variable to point to the bin folder of your desired nodejs installation. Also make sure theres only one single source for nodejs since it depends on the software u are using on how to interpret the PATH.
Under Linux you can use echo $PATH
(list can be seperated by :
) to verify.
Under Windows its echo %PATH%
(list can be seperated by ;
).
If u are using Windows, it should look something like this C:\path\to\nodeJs\bin
.
Have a look here: How to change Path under Windows
Basically you can automate this process by using NVM Node Version Manager.
It will handle everything for you.
If you use Atom
Atom specifies its own nodejs version. The path for this nodejs installation would be C:\Program Files\Atom\resources\app\apm\bin
Any other IDE / Programm
Other IDEs might use its own Nodejs aswell. If you editing your question and specifiy your environment which you use node in we might be able to give better answers.
Hope this helps! Cheers!

- 21
- 4
-
That's the mystery. I do use nvm to change the current node version, i.e nvm use
. I can also see that's what's being used, but once the project runs, there is something making it try to use version 12. I'll change the path and try – BreenDeen May 09 '23 at 13:29 -
Another thing, I forgot to mention is that I did check the path and it was not set for node. The only path that is set is for nvm. There must be something other that the path variable causing node to think it should use version 12 for the build. – BreenDeen May 09 '23 at 13:32
-
-
-
Here is how i start the project: "start": "ts-node --experimentalSpecifierResolution node ./index.ts", – BreenDeen May 11 '23 at 19:58
-
@breenDeen is this a package.json file? and ur using `npm run start`? – ScreenStare May 15 '23 at 13:19
Within a Node.js application, the location of the Node.js executable is in process.execPath
. So, have your build process log that value, and that will tell you where your Node.js executable is.
If the issue is that the build process is demanding a version of Node.js, check the engines
value in package.json
.

- 66,479
- 23
- 173
- 212
-
I had that setting all along in package.json. I feel the issue really has to do with some residual file somewhere that Node is able to use to override m, nvm, engines config and even the path variable in .bash_profile. I use ts-node — transpileOnly —- experimentalSpecificationResolution flags followed by node ./index.ts – BreenDeen May 11 '23 at 01:07
-