2012-10-15 3 views
4

Node.JS의 자연 모듈로 놀고 싶습니다. 나는 브라우저에서 입력을 받아 Bayes 분류기를 사용하여 분류하는 간단한 프로그램을 작성했습니다. 지금node.js의 "natural"모듈 사용

/home/hadoop/cloud_major/testing/node_modules/natural/node_modules/apparatus/lib/apparatus/classifier/bayes_classifier.js:95 
classifier.__proto__ = BayesClassifier.prototype; 
        ^
TypeError: Cannot set property '__proto__' of undefined 
at Function.restore (/home/hadoop/cloud_major/testing/node_modules/natural/node_modules/apparatus/lib/apparatus/classifier/bayes_classifier.js:95:27) 
at restore (/home/hadoop/cloud_major/testing/node_modules/natural/lib/natural/classifiers/bayes_classifier.js:37:54) 
at /home/hadoop/cloud_major/testing/node_modules/natural/lib/natural/classifiers/bayes_classifier.js:44:23 
at /home/hadoop/cloud_major/testing/node_modules/natural/lib/natural/classifiers/classifier.js:114:13 
at fs.readFile (fs.js:176:14) 
at Object.oncomplete (fs.js:297:15) 

연구를 위해, 나는 또 다른 Node.js를 모듈에 비슷한 문제가 있었다 누군가에 의해 다음 스레드를 통해 갔다 : 그러나, 실행시에, 나는 다음과 같은 오류가 발생합니다 https://github.com/andris9/mailcomposer/issues/6 내가 따라가 제거 및 다시 설치 자연스러운 솔루션입니다. 나는 또한 발견 http://tommytcchan.blogspot.in/2012_07_01_archive.html 내가 얻을 NPM의 LS를 사용 : Find the version of an installed npm package를 다음과 같은 출력을 가지고 :

├─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ └── [email protected] 

을 그리고, 내가 겪은

├─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ └── [email protected] 

내가 생각, 즉 그 설치된 패키지의 로컬 버전 이 패키지를 사용하고 다른 사람이이 오류를 디버그 할 수 있습니까?

미리 감사드립니다.

+0

내가 어떤 ㎖/NLP 패키지 노드 있었다 몰랐어요. 내가 기회가된다면 나는 그것을 볼 것이다. 최고의 NLP 도구는 자바와 파이썬으로 작성되었으므로이를 사용하는 것이 좋습니다. – nflacco

+0

이 문제는 최신 버전에서 재현 할 수 없습니다. 업그레이드를 시도 했습니까? [email protected]; [email protected]; [email protected]; [email protected] 그렇게하지 않으면 디버깅을 돕기 위해 질문에 코드를 추가 할 수 있습니까? – mjk

답변

0

그냥 추측하지만 부적절한 초기화로 인한 것 같습니다.

TypeError: Cannot set property '__proto__' of undefined 

처음에 초기화하는 것을 잊어 버린 개체의 속성을 사용하려고하면 비슷한 오류가 발생합니다. 오류에서 추측하여 을 정의하거나 초기화하지 않았으므로 undefined이됩니다. 당신은 undefined에서 속성을 설정하거나 사용할 수 없습니다. 여기

비슷한 게시물입니다

  1. JavaScript - cannot set property of undefined
  2. Cannot Set Property ... of undefined --- bizarre