babel + path + node 6.x: TypeError: Path must be a string. Received undefined

匿名 (未验证) 提交于 2019-12-03 02:56:01

问题:

I've been trying to update my nodejs version to 6.x but the following errors always appear everytime:

path.js:7     throw new TypeError('Path must be a string. Received ' + inspect(path));     ^  TypeError: Path must be a string. Received undefined     at assertPath (path.js:7:11)     at Object.dirname (path.js:1326:5)     at /usr/lib/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:36     at /usr/lib/node_modules/babel-core/lib/transformation/file/options/option-manager.js:396:22     at Array.map (native)     at OptionManager.resolvePresets (/usr/lib/node_modules/babel-core/lib/transformation/file/options/option-manager.js:385:20)     at OptionManager.mergePresets (/usr/lib/node_modules/babel-core/lib/transformation/file/options/option-manager.js:369:10)     at OptionManager.mergeOptions (/usr/lib/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328:14)     at /usr/lib/node_modules/babel-core/lib/transformation/file/options/option-manager.js:370:14     at /usr/lib/node_modules/babel-core/lib/transformation/file/options/option-manager.js:390:24 

I tried with those three version:

  • nodejs-6.0.0-1
  • nodejs-6.2.0-1
  • nodejs-6.2.1-1

in package.json: "babel-core": "^6.9.1"

I quite lost about where to start looking to debug. Anybody has a suggestion ? :) More info would be relevent ? Let me know !

Thanks in advance !

回答1:

The issue has something to do with Node 6. Using Node 5.x instead will probably fix the issue for you, if that's an option.

The easiest way to do this is to install Node Version Manager (or a port for Windows), then run these commands:

nvm install 5 nvm use 5 

If you want to use 5.x as your default node version, run this command:

nvm alias default 5 


回答2:

upgrade babel-core to 6.10.4..



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!