keymetrics / pm2-io-apm

PM2.io APM for Node.JS
Apache License 2.0
147 stars 40 forks source link

TypeError: namespace.charCodeAt is not a function #162

Closed yannuil closed 6 years ago

yannuil commented 6 years ago

Installed pm2@3.0.0 and it came with the lastest @pm2/io@2.1.0. Tried to start a node application and got this error.

TypeError: namespace.charCodeAt is not a function                           
    at selectColor (/opt/nvm/versions/node/v8.11.2/lib/node_modules/pm2/node_modules/debug/src/debug.js:47:46)                                                        
    at createDebug (/opt/nvm/versions/node/v8.11.2/lib/node_modules/pm2/node_modules/debug/src/debug.js:121:17)                                                       
    at ModuleUtils.detectModule (/opt/nvm/versions/node/v8.11.2/lib/node_modules/pm2/node_modules/@pm2/io/build/main/src/utils/module.js:14:25)                       
    at Function._lookForModule (/opt/nvm/versions/node/v8.11.2/lib/node_modules/pm2/node_modules/@pm2/io/build/main/src/utils/module.js:51:20)                        
    at /opt/nvm/versions/node/v8.11.2/lib/node_modules/pm2/node_modules/@pm2/io/build/main/src/utils/module.js:62:32                                                  
    at FSReqWrap.oncomplete (fs.js:135:15)

Manually installed @pm2/io@2.0.3. The error got away and managed to start the node application successfully.

Unitech commented 6 years ago

https://github.com/keymetrics/pm2-io-apm/blob/master/src/utils/module.ts#L32

wallet77 commented 6 years ago

Hi @yannuil

It was impossible for me to reproduce. It seems debug module has an empty or null namespace.

Could you console.log(err) just before this line : https://github.com/keymetrics/pm2-io-apm/blob/1f96795a5b575adea4bf1cdf6d4944c27e9e5ba0/src/utils/module.ts#L13 You can find this module under node_modules/@pm2/io directory of your pm2 installation.

Could you also run pm2 report ?

Unitech commented 6 years ago

the debug module is wrongly instanciated @wallet77 https://github.com/keymetrics/pm2-io-apm/blob/master/src/utils/module.ts#L5, plz dbl check other debug statement

wallet77 commented 6 years ago

It's already identified, wip.

wallet77 commented 6 years ago

It's fixed on 2.1.1

$ npm install pm2@latest -g
$ pm2 update