[Node JS]How to install 'ffi' and 'ref' modules on windows 10 - node.js

When I run:
npm install ffi
or
npm install ref
I got an this error
I installed node-gyp, python 2.7.11 and Visual studio build tools.
Anyone help me to fix this?

You will need to install latest version of npm by running the following command
npm i -g npm#latest

Related

Cannot Install Npx

I am getting a strange error when trying to install npx. I have node, but it says I don't.
➜ Desktop brew install npm
Warning: node 14.4.0 is already installed and up-to-date
To reinstall 14.4.0, run `brew reinstall node`
➜ Desktop npm install -g npx
zsh: command not found: npm
Why is that happening?
npx is pre-bundled with npm .no need to install npx. if u want to start a new react project (I presume)give npx create-react-app project name given that you installed the latest node version.

Error: Cannot find module 'ffi' compiling ElectronJS project

I'm new on NodeJS/ElectronJS.
I need to use User.dll functions.
My actual situation is:
Windows 10 on Parallels
Node -v = 10.15.3 (LTS)
NPM -v = 6.9.0
I installed:
npm install --global --production windows-build-tools
npm install win32-api
npm install ffi (gives me several "\ffi.cc(***): warning C4996: 'v8::Value::To Object': .... deprecated)
I added var FFI = require('node-ffi'); in my "main.js" and when I try to compile with npm start
I obtain this error:
Error: Cannot find module 'node-ffi' at Module._resolveFilename (internal/modules/cjs/loader.js:584:15)
What's wrong?
The following steps fixed my issue (major pain in the ***)
Make sure the node gyp compiler is installed
npm install -g node-gyp
Install the FFI package into the local project
npm install --save ffi
I also needed to install ref-array (part of example code)
npm install ref-array --save
Go into the node_modules/ffi directory and do an NPM install to make sure it's got all it's dependencies
cd node_modules/ffi
npm install
Get back out of the node_modules/ffi folder
cd ../../
Install the electron rebuild tools
npm install --save-dev electron-rebuild
Run the electron rebuild script (I'm running on Windows, hence .cmd)
.\node_modules\.bin\electron-rebuild.cmd
So simple (NOT) :D
Solved with this:
How do I resolve "Cannot find module" error using Node.js?
using npm install
and then
Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51
using
./node_modules/.bin/electron-rebuild

Error on installing angular/cli - not found: python2

I am trying to install with this command "npm install -g #angular/cli".
But I always get the error "Error: not found: python2"
Is there something I am missing here?
Just in case you do not want to downgrade, which is not needed anyways.
Then this is what you should do,
Fix node-sass version issue first:
The issue is with the version of node-sass (prior to the python2 error). So install it as
npm install node-sass.
Now run npm install
If it asks to fix using npm audit fix. Go ahead!
Downgrade to npm version 4, try this:
npm install -g npm#4.6.1
I had the same issue. I manage to install the python 2 version. It got solved this is the version i installed
https://www.python.org/ftp/python/2.7.15/python-2.7.15.amd64.msi

Cannot install npm modules (packages) in Windows 7?

I have node js (version 5.6.0) and npm(version 3.6.0) installed on my PC.But the problem is I am not able to install npm packages on my PC.Whenever I run npm install "somepackage" from the Cmd line, it shows "LoadDep:unorm-> get" something like this and installation stops.How can I install Npm packages?
Thanks in advance :)

libsass bindings not found when using node-sass in nodejs

I want to use the node-sass module in my node.js v0.12 application to benefit from the performance of libsass.
I executed npm i node-sass to install the module, no errors so far.
Now the mess starts:
If I just open the REPL in a terminal to try out node-sass then everything works fine but if I include it in my project files and run node myfile.js then I get the following error message:
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
The module's description at npmjs.com states that there might be a problem with resolving #!/usr/bin/env node under Ubuntu and how to fix this but that is not the case on my machine.
I could not find anything useful so I hope that you might help me.
I'm using node v0.12.2 under Ubuntu 14.10.
P.S.: I already tried to reinstall node-sass but without success. Nothing changes.
If you're using node 4.x or later then you need to reinstall gulp-sass with:
npm uninstall --save-dev gulp-sass
npm install --save-dev gulp-sass#2
You’ve probably tried to reinstall node-sass while using
npm install node-sass
or
npm uninstall node-sass
npm install node-sass
But node-sass is a C version of Sass. You have to use npm rebuild:
npm rebuild node-sass
I fixed this issue by deleting the existing /node_modules folder and running npm update
This is the only solution that worked for me,
sudo npm install -g n
sudo n 0.12.7
npm install node-sass#2
sudo npm -g install node-gyp#3
npm rebuild node-sass
This workaround (http://forum.ionicframework.com/t/error-running-gulp-sass/32311/20) worked form me.
Starting with this setup:
Cordova CLI: 5.3.3
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.0
Ionic Version: 1.1.0
Ionic CLI Version: 1.6.5
Ionic App Lib Version: 0.3.9
ios-deploy version: Not installed
ios-sim version: 5.0.1
OS: Mac OS X Yosemite
Node Version: v4.1.1
Xcode version: Xcode 6.4 Build version 6E35b
I've found a solution to avoid to use 'sudo' command. We need before to fix npm permissions following this: https://docs.npmjs.com/getting-started/fixing-npm-permissions and fixing permissions for Node here: http://mawaha.com/permission-fix-node-js/ After this we can check and reinstall software without 'sudo' for npm, n or ionic.
I followed this step:
npm install -g n
rm -R node_modules/
npm install node-sass#3.3.3
npm -g install node-gyp#3
npm uninstall gulp-sass
npm install gulp-sass#2
npm rebuild node-sass
ionic setup sass
Why node-sass#3.3.3? Because it works with latest ionic version: https://github.com/driftyco/ionic/pull/4449
Combining the two answers above worked for me, plus additions:
sudo npm uninstall --save gulp-sass
npm install --save gulp-sass#2
npm update
npm rebuild node-sass
I have solved this to create the right directory with the specified binding.node file. You can download the bindings from github
https://github.com/sass/node-sass-binaries
Look in the error message the path where it tries to find the binding. In my case:
C:\Users\Martijn\Documents\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-x64-46
So I create this map win32-x64-46 and copy the binding from github in.
My solution was to downgrade to v0.10.25 (try sudo n 0.10.25 if you use n)
For me, this issue was caused in my build system (Travis CI) by doing something kind of dumb in my .travis.yml file. In effect, I was calling npm install before nvm use 0.12, and this was causing node-sass to be built for 0.10 instead of 0.12. My solution was simply moving nvm use out of the .travis.yml file’s before_script section to before the npm install command, which was in the before_install section.
This was a Node version issue for me, try using nvm to backtrack your version to something like: 0.10.32. This worked for me. I was running 4.2.2
I solved this problem by updating my gcc from 4.4.x to 4.7.x
No need for sudo or re-installations. This has always worked for me:
nvm use 0.12.2
This is the steps I undertook to fix my issue.
I updated my node manually to the latest version
Reinstalled node-sass
npm install node-sass
3.npm audit fix to fix certain vulnerabilities.
`npm audit fix`
5.npm install node-sass
`npm install node-sass`
worked and compiled properly thereafter.
I apologize if anything related to my answer isn't right. I'm just a beginner.
Hope it works for you

Resources