Unable to find "dt~mocha" ("npm") in the registry - node.js

I am trying to setup mocha and chai in my current typescript project.
I am going through below page to implement the same:-
https://journal.artfuldev.com/write-tests-for-typescript-projects-with-mocha-and-chai-in-typescript-86e053bdb2b6
$ typings install dt~mocha --global --save
I am getting error while running above command in Ubuntu:-
typings ERR! message Unable to find "dt~mocha" ("npm") in the registry. Did you want to try searching another source? Also, if you want to contribute these typings, please help us: https://github.com/typings/registry
typings ERR! caused by https://api.typings.org/entries/npm/dt~mocha/versions/latest responded with 404, expected it to equal 200
typings ERR! cwd /home/abhishek/Desktop/TypeScript/automation/jasmine
typings ERR! system Linux 3.19.0-47-generic
typings ERR! command "/usr/local/bin/node" "/usr/local/bin/typings" "install" "dt~mocha" "--global" "--save"
typings ERR! node -v v7.7.3
typings ERR! typings -v 0.8.1
typings ERR! If you need help, you may report this error at:
typings ERR! <https://github.com/typings/typings/issues>
I tried searching the internet. Also, I tried a couple of things but it failed.
Any ideas on this on how can I fix my problem?

I went through the page and instead of running below commands:-
$ typings install dt~mocha --global --save
$ typings install npm~chai --save
I see there is a command on the page you have shared which you can use:-
There is now another method to add type definitions, from TypeScript 2.0, so we can also use that instead of the typings method mentioned above. This method does not depend upon the typings npm package or module. To make use of this, type the following commands:
$ npm install #types/chai #types/mocha --save-dev
I followed the rest of the steps and it worked !!!
I know this may not be the ultimate solution but should do.

Related

I want to create typings file for crypto-json js library

I want to import this crypto-json JavaScript library in typescript file.
When I tried running this command "typings install dt~crypto-json --global --save" but got the below error
typings ERR! system Windows_NT 10.0.14393
typings ERR! command "D:\Backup\EnvironmentVariables\node-v6.9.5-win-x64\node.exe" "D:\Backup\EnvironmentVariables\node-v6.9.5-win-x64\node_modules\typings\dist\bin.js" "install" "dt~crypto-json" "--save" "--global"
typings ERR! node -v v6.9.5
typings ERR! typings -v 2.1.1
typings ERR!
typings ERR! If you need help, you may report this error at:
typings ERR! https://github.com/typings/typings/issues
using typings version 2.1.1
DefinitelyTyped doesn't have any typings for crypto-json. You'll have to write them yourself if you want them (and then preferably publish them so others can benefit).
Additionally, you should probably move away from the Typings CLI - it's effectively been deprecated, as you can now install type definitions using NPM.
There is probably no TypeScript definitions library for crypto-json.
You can go to https://microsoft.github.io/TypeSearch/, to check if typing files exist for a library.
For example, there is one for https://www.npmjs.com/package/#types/crypto-js, but none show up for crypto-json.
You can look up tutorials of how to use JavaScript libraries when no Type Definition is available

npm installation shown can n't call method 'localeCompare' of undefined

First i installed nodemailer then it shown did n't configure correctly.After that i updated it up-to nodemailer 0.7.1 then it shown can't find mimelib module.Then i try to re-install nodemailer again then i show below error.why is that ..? when i try to install another library.It may occur.
npm ERR! Linux 3.19.0-15-generic
npm ERR! argv "node" "/usr/bin/npm" "install" "nodemailer"
npm ERR! node v0.10.25
npm ERR! npm v3.3.5
npm ERR! Cannot call method 'localeCompare' of undefined
I tried using sudo key word and try to install globally and updated all the packages but it does n't helpful.still same.
I think your issue is the version of node you're using is too old.
I had this issue and used n to run multiple versions of node.
Here's a link to options on how to upgrade node

Installing material-design-lite with NPM

I'm working on a MEAN stack (Mongo, Express, Angular, Node) and would like to use Google's Material Design Lite library. According to the docs one should run
npm install material-design-lite --save
Inside an NPM project to enable use of the mdl components. I get following error:
npm ERR! Failed at the material-design-lite#1.0.0 install script 'napa mojombo/clippy'.
npm ERR! This is most likely a problem with the material-design-lite package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! napa mojombo/clippy`
So there's a problem with napa mojombo/clippy anyone have an idea how to fix this?
try to find the root cause with verbose
npm install material-design-lite --save --verbose
npm install material-design-lite#1.0.0-3
this should work, issue here

NodeJS "npm update -g npm" fails with "Error: Refusing to delete" (Installed via package, NOT homebrew)

While trying to fix a JPG compatibility issue, I'm running into the following error when trying to update npm on my Mac OSX (Yosemite). Note that I did not install via homebrew, instead via the official package. (I'm using version 0.10.37 to counteract yet another NPM package issue).
Here are the steps I take:
brew uninstall node and brew uninstall npm to be triple-sure Node is not present on my system via Homebrew. The output is as expected, Error: No such keg: /usr/local/Cellar/node
Download the package from http://nodejs.org/dist/v0.10.37/ and install it.
node -v to verify that Node is installed.
npm update -g npm
And here's the output from that last command:
$ npm update -g npm
npm ERR! Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm
File exists: /usr/local/share/man/man3/npm-bin.3
Move it away, and try again.
npm ERR! System Darwin 14.1.0
npm ERR! command "node" "/usr/local/bin/npm" "update" "-g" "npm"
npm ERR! cwd /Users/topher
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/share/man/man3/npm-bin.3
npm ERR! code EEXIST
npm ERR! error rolling back Error: Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm
npm ERR! error rolling back at clobberFail (/usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:57:12)
npm ERR! error rolling back at next (/usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:43:14)
npm ERR! error rolling back at /usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:52:12
npm ERR! error rolling back at Object.oncomplete (evalmachine.<anonymous>:108:15)
npm ERR! error rolling back { [Error: Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm] code: 'EEXIST', path: '/usr/local/share/man/man3/npm-bin.3' }
npm ERR! not ok code 0
When I delete the above mentioned file and try again, I get another error because the npm command no longer exists. It looks like the update partially succeeded in that the npm command was deleted:
$ npm
-bash: /usr/local/bin/npm: No such file or directory
When I search for this "Refusing to delete" error, I see tons of advice for how to fix a botched Homebrew install (plus some unnecessarily condescending instructions on how to remove the Homebrew package. But I'm not installing the package via homebrew; the advice I'm finding there doesn't seem relevant in my case.
How should I go about troubleshooting this? Anyone else know of / have this problem / can think of a quick fix?
Thanks in advance!
This isn't a complete answer, but just to follow up I found a way to work around this issue.
My ultimate need was to get node running with the package resemble installed. Resemble relies on cairo, which was installed via homebrew; it seems that this was my first mistake. Because Cairo was apparently improperly installed, a couple packages were missing; this forced me to use one workaround that triggered other errors and required other workarounds... and so forth.
When I removed the Cairo homebrew package and instead built Cairo from source (using this guide), several other errors I was having just melted away.
So the lesson I'm learning is: Don't use Homebrew for anything finnicky, or for any dependencies of anything finnicky.
I solve it by this:
rm /usr/bin/npm
/usr/lib64/node_modules/npm/bin/npm-cli.js install npm -g
npm -v # success !

Issue installing hiredis on AWS Linux using OpsWorks

I'm using OpsWorks to deploy my custom node.js application. I'm not a Chef expert and thought this would be an easy process however I keep hitting snags. This most recent issue is really setting me back.
Basically I'm using a package called "Kue" which depends on a Node package called Hiredis. Hiredis is implemented at the C-level (as far as I understand) and uses some Python level compilation tools.
It seems that the default Chef script that OpsWorks uses keeps failing at the point where Kue then Hiredis is being installed. The following is the log when the instance attempts deploying the application: http://codepad.org/RXxKXqBq
Upon Googling some people are indicating its an issue with the Python version that AWS Linux is using. Note that I'm using the default Node.js application Chef recipes which can be found here: https://github.com/aws/opsworks-cookbooks/tree/release-chef-11.10/opsworks_nodejs
I'm not that familiar with node packages and version compabylity but from log that you have shared it seems it's problem in one of the node packages that you're using called amdefine:
npm ERR! Failed to parse json
npm ERR! Unexpected end of input
npm ERR! File: /home/deploy/.npm/amdefine/0.1.0/package/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! System Linux 3.14.26-24.46.amzn1.x86_64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--production"
npm ERR! cwd /srv/www/my_api/releases/20141214002817
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.14
npm ERR! file /home/deploy/.npm/amdefine/0.1.0/package/package.json
It can be fixed by npm cache clean or by changing version of nodejs, as you found too probably.
For adding command npm cache clean you must create new recipe or add it to your wrapper cookbook. Only thing that should be satisfied is that this command should be after installing node and before installing packages.
If yo want to change version, you can chceck default nodejs recepie you can see that requred version of installed nodejs is definded in attributes file for that cookbook.
So you can override default value with default[:opsworks_nodejs][:version] attribute.

Resources