简体   繁体   English

使用NPM安装cryptoJS

[英]using NPM to install cryptoJS

I'm trying to install cryptoJS at my visual studio 2015. my npm version is: 4.5.0 my node version is: v6.10.2 I've done: 1. install via nuGet Node.js 2. install via nuGet npm 我正在尝试在我的visual studio 2015中安装cryptoJS。我的npm版本是:4.5.0我的节点版本是:v6.10.2我已经完成:1.通过nuGet安装Node.js 2.通过nuGet npm安装

3. npm init --force which gave the output: 3. npm init --force给出输出:

npm : npm WARN using --force I sure hope you know what you are doing.
At line:1 char:1
+ npm init --force
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (npm WARN using ... you are doing.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

Wrote to \myProjectPath\package.json:

{
"name": "myProjectName",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"crypto-js": "^3.1.9-1",
"crypto": "^0.0.3",
"node.js": "^0.0.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"

} }

I don't think that output is valid. 我认为输出无效。 When I try to install cryptoJS : 当我尝试安装cryptoJS时:

npm install crypto-js

the output is: 输出为:

npm : npm WARN MyProjectName@1.0.0 No description
At line:1 char:1
+ npm install crypto-js
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (npm WARN MyProjectName@1.0.0 No description:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

npm
WARN
MyProjectName@1.0.0 No repository field.

how can i fix it? 我该如何解决? thanks 谢谢

You should probably test if it is working or not. 您可能应该测试它是否正常工作。 Please create a new file called crypto.js with the following code: 请使用以下代码创建一个名为crypto.js的新文件:

var sha256 = require("crypto-js/sha256");
console.log(sha256("Hello"));

Then, run it with Node : node crypto.js 然后,使用Node运行它: node crypto.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM