How can I install NODE_MODULE_VERSION 46 - npm

How can I install a Node.js version using NODE_MODULE_VERSION 46? I keep running into a NODE_MODULE_VERSION mismatch, and recompiling hasn't helped so switching node versions might be easier.
Basically, I keep coming across this:
Warning: The module '/home/cwaugh/workspaces/myproject/build/Release/addon.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 46. This version of Node.js requires
NODE_MODULE_VERSION 57. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`). Use --force to continue.
So far, I've tried using n to change to different versions (one of my dependencies requires 4.9.1 or below), but that doesn't seem to change the NODE_MODULE_VERSION as recognized by the warning.
I've also tried recompiling:
I've tried deleting node_modules and running npm install again. (this error looks like it's coming from the project root, but it never worked for anything in the node_modules folder either)
node-gyp configure --target=4.9.1 && node-gyp build --target=4.9.1. I got the idea from here, and hoped I'd have better luck than mxcd.
node-pre-gyp rebuild. I saw this, and thought it might work for me.
This works on another, older computer running a vagrant image. Unfortunately, vagrant isn't working on the new computer either, so I've been trying from scratch. Sometimes, I wonder if it's because I'm using Ubuntu 18.04. The server's can't seem to go past 16.04 when they run our docker image.

I GOT IT!
It turns out I was getting different versions from node and nodejs
$ node --version
v4.9.1
$ nodejs --version
v8.10.0
I upgrade to node v8.10.0, redo everything, and the error's gone!
sudo npm install -g n
sudo n 8.10.0
rm -rf node_modules
npm install
node-gyp clean
node-gyp configure
node-gyp build
grunt build
grunt start
# No more NODE_MODULE_VERSION error
I tried uninstalling nodejs (since this it's been replaced by just "node"), but node-grunt-cli requires it. I'm guessing that grunt uses nodejs instead of node to check its version, causing the error. The Ubuntu repositories have Grunt v0.4.5, while Grunt stable is at v1.0.3, so it's possible a newer version of grunt would also solve this problem.

The solution didn't work for me since I had just one node version (10).
What was happening in my project, was that the package.json was pulled from the remote repository with an old version package.
At the moment of installing node modules locally (using yarn), it would download up-to-date dependencies, creating incompatibility.
After trying several solutions, what finally worked for me was picking the specific package that was giving me headache (login-funcs-nodejs) and run:yarn upgrade login-funcs-nodejs --latest

Related

Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (93)

this what VSC terminal show me
Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (93)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
i tried some solutions in stack overflow:
npm rebuild node-sass
and
npm uninstall node-sass && npm install node-sass
but does't work with , i saw some people talk about node version if support sass or not,
im using v16.14.0 it's LTS version should that support i guess,
i hope someone can help and THANK YOU
It's almost like it's trying to install the 4.x branch which only supports up to Node 14.
Try installing the 7.0.1 (current latest).
npm i node-sass#7.0.1
I'd recommend going ahead and wiping node_modules prior to installing just to be safe.
If that doesn't work, can you please post the entire output in the comment?
Fix the errors due to node-sass:
1. Remove "sass" and "sass-loader" from package.json
2. rm -rf node_modules
3. npm install
4. npm install sass --save-dev
5. npm install sass-loader --save-dev
The versions of some packages is enforced in package.json. The solution is to re-add them by letting npm to establish their right version for your OS.
I fixed this issue by forcing Visual Studio to use the node version I installed instead of VS installed version of node:
Go to Visual Studio, Tools -> Options, Project and Solutions -> Web Package Management -> External Web Tools, and move the $(PATH) to the second place below .\node_modules\.bin and above $(VSInstalledExternalTools). Restart Visual Studio.
Found this solution here.

VS Code terminal fails to use npm version from nvm

I'm using nvm on my Terminal and successfully installed node 10.2.1, which also installed npm 6.1.0. However, when I go to my VS Code editor, it gives me warnings in the integrated terminal for:
npm WARN npm npm does not support Node.js v10.2.1
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4,6, 7, 8, 9.
Turns out, it is actually using npm 5.5.1 (npm -v).
I check to see what's up with that and tried to dig further and eventually used: which npm on both integrated terminal and Mac's CLI.
Mac's Terminal shows:
/Users/Aiz/.nvm/versions/node/v10.2.1/bin/npm
VS Code's Terminal shows:
/usr/local/bin/npm. Which is interesting, because if you do which node in this terminal, it results in the appropriate /Users/Aiz/.nvm/versions/node/v10.2.1/bin/node.
I'm not sure how to get my VS Code terminal to point to the appropriate npm install through nvm. Not sure if it helps, but I checked npm get prefix and npm -g bin to find /Users/Aiz/.nvm/versions/node/v10.2.1. The only difference I'm finding is where each terminal is using npm from.
I ended up looking through VS Code issues on GitHub and came across something relevant to NVM and node issues. It fixed my issue since the underlying cause was the same.
Essentially what happened is that I had a global install of node before that I removed prior to using NVM but hadn't removed my global install of npm. This was causing conflicts in VS Code's terminal (not Mac's terminal). In order to fix this, you essentially have to find the symlink for which npm and remove the node_modules and npm associated recursively.
Here's the link you'll need: https://github.com/Microsoft/vscode-docs/blob/master/docs/editor/integrated-terminal.md#why-is-nvm-complaining-about-a-prefix-option-when-the-integrated-terminal-is-launched.
Don't forget to restart your editor after.
Another solution is to implement this. https://medium.com/#kinduff/automatic-version-switch-for-nvm-ff9e00ae67f3
Basically, nvm will check for a .nvmrc and switch or default each time you go to a new directory in shell.
It does have a dependency on zsh.
The fix for me on Ubuntu:
A.) sudo apt-get remove nodejs npm
B.) Removed lines in my .bashrc that added the npm package directory to the path.
C.) Restart VS Code.
I doubt step A is necessary. But B and C certainly are.

Cannot upgrade aurelia-cli from 0.21.0 to 0.23.0

When I try to upgrade aurelia-cli from 0.21.0 to 0.23.0 on Mac OS X 10.11.6, au -v displays the version as 0.21.0 instead of 0.23.0. I even tried the following, to no avail.
npm uninstall aurelia-cli -g
npm cache clean
npm install aurelia-cli -g
au -v
0.21.0
npm outdated
Package Current Wanted Latest
aurelia-cli 0.21.0 0.23.0 0.23.0
There's a few things you'll need to do. First, and based on your comments, you may have already done this: you need to run npm install aurelia-cli --save-dev. This will update the local version of the Aurelia CLI. Each Aurelia project gets its own local version of the CLI so that upgrading your global version of the CLI won't magically break something in a project. This is especially important currently with the CLI in alpha and thus the possibility of breaking changes being somewhat likely.
If you have already done this and you're still seeing 0.21.0 when you run au -v, then run rm -rf node_modules in the project directory and then npm install. Sometimes npm can be a pain in the butt.
As you are moving from v0.21.0 of the CLI to v0.23.0, you will need to follow the instructions for updating your aurelia.json file found here. These instructions are unrelated to the problem you're having, but you need to be aware of them.
I hope this helps!

Trying to install grunt-cli, but need help to upgrade to lodash#^3.0.0

I was working through the Thinkster Angular/Firebase tutorial and in the installation process I got to the part where I needed to install grunt-cli with this command in the terminal:
npm install -g bower grunt-cli
and got this error:
lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^3.0.0.
How do I upgrade my lodash?
This is probably because of the dependency chain. I guess grunt is still stocking to the older version of lodash. I think you should be fine as long as grunt is supporting it.
You find more info on this at https://github.com/Azure/azure-mobile-apps-js-client/issues/20

Travis not installing npm modules

I'm new to travis- I'm trying to get it to install my npm modules for my project and can't even get past that. "npm install" and "npm test" work fine on my computer (a mac). However, when I push my commits to travis it complains that:
Error: No compatible version found: ini#'^1.2.0'
Valid install targets:
npm ERR! ["1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.1.0","1.2.0","1.2.1","1.3.0"]
Note that ini is not something I was originally including in my package.json, but it is depended on by something that I am using. I tried explicitly adding the 1.2.0 version of ini to my package.json but it still complains. I get similar complaints about other upstream dependencies.
Is there something about how travis is doing npm install that greatly differs from my local machine where it is working fine? Really stumped here.
Here's a link to my latest travis failed build: https://travis-ci.org/infomofo/chrome-angular-md-template/builds/35592993
This is due to the NPM version coming with Node.js 0.8. It doesn't support the ^ syntax for declaring dependecies.
You could either use Node.js instead:
node_js: 0.10
Or you could update npm, which would bring support for the dependency version:
before_install: npm update -q