How to know where NPM is installing its binaries? - node.js

After updating NPM, my binaries are not getting installed properly. The module itself is getting installed at /usr/local/lib/node_modules, but the binary is not getting installed at /usr/local/bin.
How do I know the path where the binaries are getting installed?
Thanks!

Related

Node Canvas throwing error when running project

Node Canvas is not working for me on m1
When I try to run my project I get this error message:
Error: dlopen(.../node_modules/canvas/build/Release/canvas.node, 0x0001): tried: '.../node_modules/canvas/build/Release/canvas.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/canvas.node' (no such file), '/usr/lib/canvas.node' (no such file)
Already did:
brew install pkg-config cairo pango libpng jpeg giflib librsvg
xcode-select --install
npm i canvas
With no errors
Not sure how to debug this as there are people with Node Canvas working on m1 laptops, please help.
The most important thing is to make sure your Node executable has been compiled for Apple Silicon, meaning there's a pre-built binary for darwin-arm64. You can see which versions have which binaries here (the following page has the binaries for Node version 16.13.1): https://nodejs.org/download/release/v16.13.1/.
Node v14 has no pre-built binaries for darwin-arm64 (see https://github.com/nodejs/node/issues/36161), because it can't be compiled natively to Apple Silicon.
I use volta (https://volta.sh/) to manage my Node versions, so if you install Node v16 with volta install node#16 and then run npm i canvas, you should get a correctly compiled canvas.node file.
If that fails, go to node_modules/canvas and run npm install --build-from-source, which will compile the C++ addon and output the corect canvas.node.
You can check this by running:
file node_modules/canvas/build/Release/canvas.node
# outputs: node_modules/canvas/build/Release/canvas.node: Mach-O 64-bit bundle arm64
If it says arm64 at the end, then you're good to go. If it still says x86_64, then something went wrong.
I use npm install --build-from-source. It work!
But there are new mistakes
dlopen(.../node_modules/canvas/build/Release/canvas.node, 0x0001): symbol not found in flat namespace '_cairo_fill'

Unable to resolve "./prebuilt.rn-f9cd27ba.js" from "node_modules\#firebase\firestore\dist\rn\index.js"

I was writing my code and I want some module to be installed so I installed all the required module but after that, I am getting this (Unable to resolve "./prebuilt.rn-f9cd27ba.js" from "node_modules#firebase\firestore\dist\rn\index.js") error again and again so I tried to uninstall all the module which I have installed and I also tried to reinstall, run npm install, and much more but this issue is not fixed pls help
Make sure you are running a modern version of Node.js (or whatever version your project is using (nvm can help with this).
Delete your node_modules directory and run npm install again.

Npm throws error while installing a package

I'm developing a reactjs project and could add any package using npm. All of a sudden npm installer began to throw error for any package installation. The error is same for all packages. I removed and reinstalled Nodejs, but the error is there as a rock.
Error:
Error log:
Any idea to solve this problem?
Thanks in advance :)
The cli-table3 is the source of issue. I think this package is installed and used by Node.js itself to be able to display table format in console. I uninstalled the Node.js and then deleted npm and npm-cache folders of the path C:\Users\UserName\AppData\Roaming - Of course i didn't have any global package installed. Then reinstalling Node.js solved the issue.

Re-installing Node JS failed

I am using RHEL 6.
I needed to uninstall NodeJS and install a different version of it.
I found various methods for uninstalling it and as instructed deleted all the node and npm related files.
But when i try to install it again i get the following error -
Package nodejs-6.2.1-1nodesource.el6.x86_64 already installed and latest version
Nothing to do
Any help ?

Node.js error : failed to initialize context

I just installed Node.js from Visual Studio installation.
When I tried to call node on the command prompt, I got this error. I also got this when I tried to do npm init and npm install
How do I fix this?
I encountered this problem on my Windows 10 64-bit computer. From looking at Programs and Features, I saw that I had Node.js and Node.js Chakra installed. I uninstalled Node.js and then downloaded and installed again it from https://nodejs.org/en/download/.
This, however, did not fix the problem. So I uninstalled Node.js Chakra; and when I opened a new command prompt, node and npm were working.
However, I'm not sure if I needed to uninstall and reinstall Node.js or if I only needed to uninstall Chakra. I probably should have uninstalled Chakra first and node and npm might have worked after that.

Resources