javascript - Chart.js not installing with NPM - Stack Overflow

I am trying to install chart.js . Their documentation for how to install the package with NPM is here :

I am trying to install chart.js . Their documentation for how to install the package with NPM is here : .html

It says to enter the following with NPM to install.

npm install chart.js --save

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:

EDIT: 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+/(my username)/(my repo).git"
  },
  "keywords": [
    "stk"
  ],
  "author": "Hashim",
  "license": "ISC",
  "bugs": {
    "url": "/(myusername)/(my repo)/issues"
  },
  "homepage": "/(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

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

It says to enter the following with NPM to install.

npm install chart.js --save

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:

EDIT: 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./(my username)/(my repo).git"
  },
  "keywords": [
    "stk"
  ],
  "author": "Hashim",
  "license": "ISC",
  "bugs": {
    "url": "https://github./(myusername)/(my repo)/issues"
  },
  "homepage": "https://github./(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

Share Improve this question edited Jul 4, 2017 at 6:26 Hashim asked Jul 4, 2017 at 5:52 HashimHashim 552 gold badges3 silver badges9 bronze badges 2
  • 1 Works fine for me on OS X. Could it be you don't have a package.json file in the current directory? – Phil Commented Jul 4, 2017 at 5:55
  • I had a package.json but remade it since I may have done it incorrectly. Even after redoing the package.json, the error remains when I try to install chart.js with NPM – Hashim Commented Jul 4, 2017 at 6:19
Add a ment  | 

3 Answers 3

Reset to default 4

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

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

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

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

Hope this helps!

I had the same issue while running webpack server in the backgorund When I shut down the local server, package got installed no problem.

I have faced the same issue while installing chart.js using npm.

it seems you have to stop ng serve and then try npm install chart.js --save because I tried the same and it is working fine in the same folder.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742351714a4427649.html

相关推荐

  • javascript - Chart.js not installing with NPM - Stack Overflow

    I am trying to install chart.js . Their documentation for how to install the package with NPM is here :

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信