can't install mmmagic with npm install - node.js

I want to install module mmmmagic in my projet using npm install mmmgic, I come across the following error

You either don't have MSVC installed or your build environment isn't set up properly. If you do have MSVC installed, you might try using one of the special VS201x Command Prompts and executing your npm install mmmagic from there instead.

Related

Unexpected end of JSON input error when creating new project

Each time I use angular/cli to create a new project by launching the following command
ng new Project-Name
I get the following error
npm ERR! Unexpected end of JSON input while parsing near '...-4","#angular/common"'
I tried to force clean the cache and re-try but still face the same problem.
NodeJS version: 12.16.3
npm version: 6.14.4
Angular CLI version: 9.1.4
OS: Windows 10 Home win32 x64
Edit: All the commands above I run them in Powershell as administrator
This is not a definitive answer but it looks like your global packages are corrupted in some way.
This bug may be caused by many different things. I suggest doing the following.
Install Node Version Manager (or NVM for Windows) and install Node version 10.16.1. This is enough for angular 9 and from my experience it is the most stable version for development. This should also change your NPM version so that may also help.
Uninstall global angular package npm uninstall -g #angular/cli
Force clear cache npm cache clean --force
Just to double check npm cache verify
You can also try clearing your %temp% and %roaming% AppData/npm-cache
install latest angular package npm install -g #angular/cli#<your-version>
if this error still occurs, consider using another shell
If this don't solve the problem try to manually locate the package.json file that is throwing an error and investigate.

unable to run npm command. tty.js not installing

I am working on an application that extends Adobe brackets. Here I need to add terminal/console in that. I have installed node.js and npm server already.
Now i need to run npm install -g tty.js command but it show me this error
work-round->
try without -g, this will #least install on local dir. more over u need 2 come in terms with npm support team.
email support#npmjs.com to get your copy of this package..
you can also work with stand-alone copies available on i-net.. here is one such link where you can find full source-code for term.js..
https://github.com/chjj/term.js/blob/master/src/term.js
OR
install web-terminal package from npm, with CLI use command : 'sudo npm install web-terminal -g'

How to pass options to dependent package installs for npm?

My node.js project has a dependency on node-sqlite, but unfortunately the default libsqlite binary embedded there was not built with options I need.
Now I can invoke npm install on that package alone to get it to build correctly:
CFLAGS=-DSQLITE_ENABLE_STAT4 npm install sqlite3 --build-from-source
Essentially, this sets the environment variable and passes an option to the tool.
However, npm install by itself should just install all the project dependencies, including sqlite. How do I encode package.json or elsewhere so that npm install will install the sqlite dependency with the above command line?
You could use a preinstall or a postinstall script to do this.
#!/bin/bash
CFLAGS=-DSQLITE_ENABLE_STAT4 npm install sqlite3 --build-from-source;
Put this in scripts/install_sqlite3_from_source.sh, and set scripts.preinstall or scripts.postinstall in your package.json to it.

Using npm to install packages gives command not found?

Using npm to install packages, I can never use their cli. For instance, install grunt-cli, avn, nvm, etc. and running
npm install -g avn avn-nvm avn-n
avn setup
Results in command "avn" not found. I don't know if this is a pathing issue, but my PATH is:
/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin:/usr/local/sbin:/usr/local/opt/ruby/bin:/usr/local/lib/python2.7/site-packages:/usr/local/share/npm/bin
I am using OSX.
Your path does not include where the node_modules you're installing globally exist. You need to include the bin path for the modules:
export PATH=$PATH:/usr/lib/node_modules/.bin

Node.js modules installed through npm not recognized

So I've installed and reinstalled node.js many times and tried various installs of the npm. I am currently on node version 0.6.11. When I try to install a new module with npm I get several errors. I am extremely new to programming with node but I have tried researching this problem but haven't found a proper answer. When I install a module with npm and then try to use it in command prompt nothing happens. All I get is for example
'haraka' is not recognized as an internal or external command,
operable program or batch file.
This happens to every module I install. What am I missing here. Please help. I am getting really frustrated with node
By default, npm will install packages locally, in ./node_modules. So if you are in /home/foo:
user#host:/home/foo$ npm install Haraka
Haraka will be installed in /home/foo/node_modules/Haraka. If you want to install a module globally (by default in /usr/local/lib/node_modules), supply the -g switch:
user#host:/home/foo$ sudo npm install -g Haraka
Haraka will be installed in /usr/local/lib/node_modules/Haraka, and the command haraka will be symlinked to /usr/local/bin/haraka.
It's recommended that any dependencies be installed locally. This way, you never have to bother with different packages requiring different versions of their dependencies, aka "dependency hell". I have all my projects in ~/development/projects, and each node project has it's own node_modules folder.

Resources