Chart.js未与NPM一起安装 [英] Chart.js not installing with NPM

查看:104
本文介绍了Chart.js未与NPM一起安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装chart.js。有关如何使用NPM安装软件包的文档,请参见: http:/ /www.chartjs.org/docs/latest/getting-started/installation.html

I am trying to install chart.js . Their documentation for how to install the package with NPM is here : http://www.chartjs.org/docs/latest/getting-started/installation.html

它说要在NPM中输入以下内容进行安装。

It says to enter the following with NPM to install.

npm install chart.js --save

但是,它对我不起作用。当我尝试使用NPM安装chart.js时,在控制台中出现followin错误。

However, it doesn't work for me. I get the followin error in my console when I try to install chart.js with NPM.

C:\Users\Hashim AHmed\Desktop\Hashim\coding\Project_PlasmaBird\yahoo_finance>npm install chart.js --save
npm ERR! not a package (MY PROJECT DIRECTORY)\yahoo_finance\chart.js
npm ERR! addLocal Could not install (MY PROJECT DIRECTORY)\yahoo_finance\chart.js
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "chart.js" "--save"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! path C:\Users\HASHIM~1\AppData\Local\Temp\npm-6480-170f285f\unpack-fccf9cad\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\HASHIM~1\AppData\Local\Temp\npm-6480-170f285f\unpack-fccf9cad\package.json'
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\HASHIM~1\AppData\Local\Temp\npm-6480-170f285f\unpack-fccf9cad\package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     (mydirectory)\npm-debug.logwing error:

编辑:正如某些人指出的那样,错误可能在我的Package.json中,所以这是我的包文件的代码(我检查了一些私人信息):

As some have pointed out, the error may lie in my Package.json so here is the code of my package file (i have censored out some private info) :

{
  "name": "projectplasma",
  "version": "1.0.0",
  "description": "projectplasma",
  "main": "index.js",
  "dependencies": {
    "colors": "^1.1.2",
    "yahoo-finance": "^0.3.2"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/(my username)/(my repo).git"
  },
  "keywords": [
    "stk"
  ],
  "author": "Hashim",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/(myusername)/(my repo)/issues"
  },
  "homepage": "https://github.com/(my username)/(my repo)#readme"
}

对这里出什么问题有任何想法吗?我做的恰恰是文档所说的。如果有人可以测试安装此程序以查看其是否正常运行,那就太好了。谢谢

Any ideas of what's going wrong here? I am doing exactly as the documentation is saying. If someone could test install this to see if it is working, that would be great. Thanks

推荐答案

您需要在文件中放入 package.json 文件目录,以将此 chart.js 模块保存在本地。

You need to have the package.json file in your directory to have this chart.js module saved locally.

创建软件包。 json 文件,请使用以下命令,

To create a package.json file, use the below command,

npm init (会询问您几个问题,将在最后创建文件。)

npm init (which will ask you few questions and will create the file at the end).

一旦创建了 package.json ,请尝试执行 npm install chart.js --save 命令,看看是否可行。

Once you create your package.json try executing the npm install chart.js --save command and see if it works.

希望这会有所帮助!

这篇关于Chart.js未与NPM一起安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆