简体   繁体   English

错误说没有package.json,但它在当前目录中

[英]Error says no package.json, but it is in current directory

Hi I am receiving the following error when trying to install any packages using npm install using the command npm install "package name": 您好我在使用命令npm install“package name”尝试使用npm install安装任何软件包时收到以下错误:

npm ERR! path C:\Users\abecker\Documents\Git-ng2-Admin\file:..\has-unicode\package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! package.json ENOENT: no such file or directory, open 
'C:\Users\abecker\Documents\Git-ng2-Admin\file:..\has-unicode\package.json'
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\abecker\AppData\Roaming\npm-cache\_logs\2017-06-21T03_36_11_730Z-debug.log

I have a package.json file within the root folder(Git-ng2-Admin). 我在根文件夹(Git-ng2-Admin)中有一个package.json文件。 However, according to the error it says it needs to go to Git-ng2-Admin\\file:..\\has-unicode\\ to find the json file, which is incorrect. 但是,根据错误,它说它需要转到Git-ng2-Admin \\ file:.. \\ has-unicode \\来查找json文件,这是不正确的。 Is there a way to reconfigure where the package.json file is supposed to be searched for? 有没有办法重新配置应该搜索package.json文件的位置?

edit: added the package.json file as requested 编辑:根据请求添加了package.json文件

{
"name": "ng2-admin",
"version": "1.0.0",
"description": "Angular and Bootstrap 4 Admin Template.",
"author": "Akveo <contact@akveo.com>",
"homepage": "http://akveo.github.io/ng2-admin/",
"repository": {
  "type": "git",
"url": "git+https://github.com/akveo/ng2-admin.git"
},
"bugs": {
  "url": "https://github.com/akveo/ng2-admin/issues"
},
"license": "MIT",
"scripts": {
  "ng": "ng",
  "rimraf": "rimraf",
  "changelog": "standard-changelog",
  "start": "ng serve",
  "start:hmr": "ng serve --hmr",
  "start:aot": "ng serve --aot",
  "start:prod": "ng serve --prod",
  "start:prod:aot": "ng serve --prod --aot",
  "build": "npm run clean:dist && ng build",
  "build:prod": "npm run build -- --prod",
  "build:prod:aot": "npm run build:prod -- --aot",
  "build:ci": "npm run build:prod && npm run build:prod:aot",
  "build:demo": "npm run build:prod:aot -- --base-href \"http://akveo.com/ng2-admin/\"",
  "test": "ng test -sr",
  "test:coverage": "npm run clean:coverage && ng test -sr -cc",
  "lint": "ng lint",
  "lint:styles": "stylelint ./src/app/**/*.scss",
  "lint:ci": "npm run lint && npm run lint:styles",
  "pree2e": "webdriver-manager update --standalone false --gecko false",
  "e2e": "ng e2e",
  "clean:dist": "npm run rimraf -- dist",
  "clean:coverage": "npm run rimraf -- coverage",
  "docs:deploy": "wintersmith build -C docs && gh-pages -d docs/build",
  "docs:serve": "wintersmith preview -C docs"
},
"private": true,
"dependencies": {
  "@angular/animations": "4.1.3",
  "@angular/common": "4.1.3",
  "@angular/compiler": "4.1.3",
  "@angular/core": "4.1.3",
  "@angular/forms": "4.1.3",
  "@angular/http": "4.1.3",
  "@angular/platform-browser": "4.1.3",
  "@angular/platform-browser-dynamic": "4.1.3",
  "@angular/platform-server": "4.1.3",
  "@angular/router": "4.1.3",
  "@ng-bootstrap/ng-bootstrap": "1.0.0-alpha.26",
  "@ngx-translate/core": "6.0.1",
  "@ngx-translate/http-loader": "0.0.3",
  "amcharts3": "github:amcharts/amcharts3",
  "ammap3": "github:amcharts/ammap3",
  "angular2-datatable": "0.6.0",
  "animate.css": "3.5.2",
  "bootstrap": "4.0.0-alpha.6",
  "chart.js": "1.1.1",
  "chartist": "0.10.1",
  "chroma-js": "1.3.3",
  "ckeditor": "4.6.2",
  "core-js": "2.4.1",
  "easy-pie-chart": "2.1.7",
  "font-awesome": "4.7.0",
  "fullcalendar": "3.3.1",
  "google-maps": "3.2.1",
  "ionicons": "2.0.1",
  "jquery": "3.2.1",
  "jquery-slimscroll": "1.3.8",
  "leaflet": "0.7.7",
  "leaflet-map": "0.2.1",
  "lodash": "4.17.4",
  "ng2-ckeditor": "1.1.6",
  "ng2-completer": "1.3.1",
  "ng2-handsontable": "0.48.0",
  "ng2-slim-loading-bar": "4.0.0",
  "ng2-smart-table": "1.2.1",
  "ng2-tree": "2.0.0-alpha.5",
  "ngx-uploader": "2.2.5",
  "normalize.css": "6.0.0",
  "roboto-fontface": "0.7.0",
  "rxjs": "5.4.0",
  "zone.js": "0.8.11"
},
"devDependencies": {
 "@angular/cli": "1.1.2",
  "@angular/compiler-cli": "4.1.3",
  "@types/fullcalendar": "2.7.40",
  "@types/jasmine": "2.5.38",
  "@types/jquery": "2.0.41",
  "@types/jquery.slimscroll": "1.3.30",
  "@types/lodash": "4.14.61",
  "@types/node": "6.0.69",
  "codelyzer": "3.0.1",
  "gh-pages": "0.12.0",
  "jasmine-core": "2.5.2",
  "jasmine-spec-reporter": "3.2.0",
  "karma": "1.4.1",
  "karma-chrome-launcher": "2.0.0",
  "karma-cli": "1.0.1",
  "karma-coverage-istanbul-reporter": "0.2.0",
  "karma-jasmine": "1.1.0",
  "karma-jasmine-html-reporter": "0.2.2",
  "npm-run-all": "4.0.2",
  "protractor": "5.1.0",
  "rimraf": "2.6.1",
  "standard-changelog": "1.0.1",
  "stylelint": "7.10.1",
  "ts-node": "2.1.2",
  "tslint": "5.2.0",
  "tslint-eslint-rules": "4.0.0",
  "tslint-language-service": "0.9.6",
  "typescript": "2.3.2",
  "typogr": "0.6.6",
  "underscore": "1.8.3",
  "wintersmith": "2.2.5",
  "wintersmith-sassy": "1.1.0"
},
"main": "karma.conf.js",
"directories": {
  "doc": "docs"
}
}

在尝试npm install之前删除package-lock.json再次为我解决了这个问题

I had the same problem. 我有同样的问题。 After a quick search, found this bug . 快速搜索后,发现了这个bug

Finally ended up finding a strange entry in package-lock.json: 最后在package-lock.json中找到了一个奇怪的条目:

"has-unicode": {
  "version": "file:file:..\\has-unicode",
  "integrity": "sha1-o82Wwwe6QdVZxaLuQIwSoRxMLsM=",
  "dev": true
},

and removing it solved my problem. 并删除它解决了我的问题。

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

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