npm 창을 전체적으로 설치하면 npm ERR이 발생합니다! 관계 없는
나는 grunt와 npm을 처음 사용합니다. 그래서 나는 ' http://tech.pro/tutorial/1190/package-managers-an-introductory-guide-for-the-uninitiated-front-end-developer#front_end_developers ' 사이트에서 "요리 책 예제"를 시도하고 있습니다. . 지금 그곳을 볼 필요는 없지만 사이트를 공유하는 것이 좋을 것이라고 생각했습니다. 지금까지는 전역 설치에 이르기까지 훌륭했습니다. (좋아, 일부 오류를 알아 내야했지만 지금은 npm으로 작업하고 있습니다).
전 세계에 무언가를 설치하려고 할 때 나는 붙어 있습니다.
일부 패키지를 전체적으로 설치하여 테스트하기 위해 지금까지 한 것 :
테스트 디렉토리 작성
grunttest
그 디렉토리 안에서 :
npm install -g jshint
내가 볼 수있는 출력 :
npm http GET https://registry.npmjs.org/jshint
npm http 304 https://registry.npmjs.org/jshint
...
npm http 304 https://registry.npmjs.org/string_decoder
C:\Program Files\nodejs\node_modules\npm\jshint -> C:\Program Files\nodejs\node_modules\npm\node_modules\jshinnt
jshint@2.4.4 C:\Program Files\nodejs\node_modules\npm\node_modules\jshint
├── console-browserify@0.1.6
├── exit@0.1.2
├── underscore@1.4.4
├── shelljs@0.1.4
├── minimatch@0.2.14 (sigmund@1.0.0, lru-cache@2.5.0)
├── cli@0.4.5 (glob@3.2.9)
└── htmlparser2@3.3.0 (domelementtype@1.1.1, domutils@1.1.6, domhandler@2.1.0, readable-stream@1.0.26-2)
방금 마지막 설치 이후 리소스가 수정되지 않았다고 말했기 때문에 304가 좋습니다. 몇 분 전입니다.
jshint가 존재하는지 확인 :
`npm -global list`
산출:
npm@1.4.3 C:\Program Files\nodejs\node_modules\npm
├── abbrev@1.0.4
├── ansi@0.2.1
├─...
├──
├── graceful-fs@2.0.2
├── inherits@2.0.1
├── ini@1.1.0
├─┬ init-package-json@0.0.14
│ └── promzard@0.2.1
├─┬ jshint@2.4.4 extraneous
│ ├─┬ cli@0.4.5
│ │ └─┬ glob@3.2.9
│ │ └── inherits@2.0.1
│ ├── console-browserify@0.1.6
│ ├── exit@0.1.2
│ ├─┬ htmlparser2@3.3.0
│ │ ├── domelementtype@1.1.1
│ │ ├── domhandler@2.1.0
│ │ ├── domutils@1.1.6
│ │ └─┬ readable-stream@1.0.26-2
│ │ └─... ├── text-table@0.2.0
├── uid-number@0.0.3
└── which@1.0.5
**npm ERR! extraneous: jshint@2.4.4 C:\Program Files\nodejs\node_modules\npm\node_modules\jshint npm**
질문 :
- 왜 npm ERR을 얻습니까? 외부 ...?
- 무슨 뜻인가요?
- 이 문제를 어떻게 해결할 수 있습니까?
정보:
cygwin을 쉘로 사용하는 Windows 시스템 Windows 7입니다. jshint someTestfile.js
물론 jshint ( )를 시도하는 것은 효과가 없습니다.
미리 감사드립니다, Meru
npm ERR! extraneous
는 패키지가 설치되었지만 프로젝트에 나열되지 않음을 의미합니다 package.json
.
전 세계적으로 설치된 패키지를 나열하기 때문에 전 세계적으로 설치된 대부분의 프로젝트가 프로젝트에 포함되지 않기 때문에 무시할 수있는 많은 외부 오류가 발생합니다 package.json
.
1 & 2: It means you don't have the jshint listed in your project's package.json file but that it is globally installed. So it is not a big problem.
3: To avoid this extraneous error, you can run or re-run the install with the option --save
. This will update automatically you package.json file :
npm install -g jshint --save
Or need to update manually your package.json file with a "dependencies": {...}
I resolved this by doing an npm update
in the parent package's folder which removed some of the extraneous packages from the list and then did npm uninstall <package>
for the remaining few.
Seems to have worked, as I'm getting no errors after doing this.
I solved it by combining all the answers. At first I installed the package globally.
npm install -g packagename --save
Since npm installed this packaged as well globally but did not add it to my local package.json file, I had to do something about it.
I choose, the solution to remove the local one and then install it globally.
npm uninstall packagename
npm install -g packagename
This way I have no more warnings and do not mess up the package.json file.
I my case, I saw this 'npm ERR! extraneous' message in my cygwin terminal when i did an 'npm ls'. I thought this was some sort of a globally corrupted setup after having lots of tinkering. I learn the following observations here:
- 'npm ls' gives different outputs depending on what is your current folder location.
- 'npm ls' tries to detect the presence of a 'node_modules' folder in the current folder location, and list out those contents. NOT the global ones!
- Furthermore, if the current folder containing 'node_modules' also has a package.json file containing fewer modules listed here, then the error shows.
I 'rm package.json' and 'npm ls' no longer shows error message. So I say, that always check the current location for the presence of 'node_modules' folder and the package.json file because these are prioritize first in the check and if these are missing, the check continues to to the parent folder and so on, and if you have tinkered a lot of code snippets a lot, then you may have scattered around lots and lots of node_modules folder and package.json file. Nothing is really corrupted here, unlike those experiences we have when doing J2EE Java development / eclipse IDE or during the days when we have to use regedit to change settings in Windows.
In my case it was because the package name in its package.json
file was not the same as the depency name listed in the package.json
of the dependent module. My error, since it's a new module I created, but hard to spot, since npm won't give any clue.
This happened when using the dependencies: { "my-module": "file:local-modules/mymodule" }
syntax, with a typo in the name "my-module".
This is due to the fact that your package is not in your package.json. If you add it, the problem will be solved, please look at the image below:
'IT박스' 카테고리의 다른 글
(이미지)보기 알파에 대한 Android 및 설정 알파 (0) | 2020.07.24 |
---|---|
이유 : 적합한 이미지가 없습니다. (0) | 2020.07.24 |
Gson이 "<"및 ">"를 유니 코드 이스케이프 시퀀스로 변환하는 것을 피할 수 있습니까? (0) | 2020.07.23 |
jQuery datepicker는 선택된 날짜를 즉석에서 설정합니다. (0) | 2020.07.23 |
iPad에서 만든 HTTP 요청을 어떻게 리디렉션합니까? (0) | 2020.07.23 |