簡體   English   中英

如何在npm install上解決這個問題:( npm ERR!install無法讀取依賴項)?

[英]How to fix the this on npm install: (npm ERR! install Couldn't read dependencies )?

您好我在安裝npm時遇到問題:我嘗試刪除並重新安裝但不起作用,甚至刪除所有文件夾。

> lucas@lucas:~$ npm install
> npm ERR! install Couldn't read dependencies
> npm ERR! Linux 4.2.0-35-generic
> npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
> npm ERR! node v4.4.2
> npm ERR! npm  v2.15.0
> npm ERR! file /home/lucas/package.json
> npm ERR! code EJSONPARSE

> npm ERR! Failed to parse json
> npm ERR! Unexpected token ':' at 1:17
> npm ERR!   "dependencies": {
> npm ERR!                 ^
> npm ERR! File: /home/lucas/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! Please include the following file with any support request:
> npm ERR!     /home/lucas/npm-debug.log

NPM告訴你發生了什么:

> npm ERR! File: /home/lucas/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

確保您的JSON文件有效。 您可以在JSONLint上進行檢查 以下是依賴項部分的外觀。 注意周圍的對象括號。

{ "dependencies" :
  { "foo" : "1.0.0 - 2.9999.9999"
  , "bar" : ">=1.0.2 <2.1.2"
  , "baz" : ">1.0.2 <=2.3.4"
  , "boo" : "2.0.1"
  , "qux" : "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0"
  , "asd" : "http://asdf.com/asdf.tar.gz"
  , "til" : "~1.2"
  , "elf" : "~1.2.3"
  , "two" : "2.x"
  , "thr" : "3.3.x"
  , "lat" : "latest"
  , "dyl" : "file:../dyl"
  }
}

請參閱這篇關於NPM文檔的“依賴項”部分的文章,並確保您的package.json部分看起來相似,尤其是“依賴”之前的任何字符。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM