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

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

Related

Unable to find "dt~mocha" ("npm") in the registry

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.

npm not working properly on windows 10

I have node.js installed via nvm, i have several versions and for some reason npm doesn't work on any of them. The versions are 4.5.0, 5.8.0 and 6.5.0 with their corresponding npm versions which i can't get because when i type npm -v
$ npm -v
[TypeError: Cannot read property 'readFileSync' of undefined]
And if i try to npm install on any project i get something similar to this (varies a little bit from project to project)
$ npm install
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.5.0
npm ERR! npm vTypeError: Cannot read property 'readFileSync' of undefined
npm ERR! Invalid Version: TypeError: Cannot read property 'readFileSync' of undefined
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
|
npm ERR! Please include the following file with any support request:
npm ERR! C:\repos\bakeIn\npm-debug.log
I've tried uninstalling nvm and reinstalling it, also removing it completely and then getting a fresh install of node and npm (not via nvm) from their website, but i get the same result. I rebooted my machine just in case but no luck.
I haven't been able to find something helpful on google or here, or maybe I'm missing something.
In any case its like the fs module is not available to npm when it runs, it was working correctly a couple of days ago.
Thanks in advance for any help :)
In this particular case, doing a full scan for rootkits, spywares, virus, etc with different software's and cleaning what was found solved the issue. Not sure specifically what caused it but it was due to a program of that nature.

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

Error Node downgrading

I am a beginner in development, but I want to become a leading developer of mobile applications ;)
I am on Windows 8. I want to install Cordova but I have to downgrade Node I currently 0.12.x. Version I could see that he had to make a downgrade in 0.10.x. Version
I do a downgrading but when I want to install an earlier version (0.10.32 and others)
npm unistall n
npm install n#0.10.32
I have the following errors:
C:\Users\Jeremy>npm install n#0.10.32
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (
x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "n#0.10.32"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! version not found: n#0.10.32
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Jeremy\npm-debug.log
if your workflow does not involve global npm installs, etc, one approach is to simply use the node.exe executable as a stand-alone -- just grab the version you need from nodejs.org/dist and drop it into the working directory for a particular project. (Node.exe can run without actually 'installing' anything onto the system.)
then you could then specify the version of packages that you need for that version of node.exe like so: npm install foo#0.1.1.

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