Npm错误“未定义internalBinding”

时间:2019-03-19 14:08:42

标签: node.js npm

我在安装gulp时遇到了一些问题,直到出现“ npm install”错误npm install error example

npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'npm' ]
2 info using npm@3.6.0
3 info using node@v11.12.0
4 verbose stack ReferenceError: internalBinding is not defined
4 verbose stack     at evalmachine.<anonymous>:25:1
4 verbose stack     at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/fs.js:11:1)
4 verbose stack     at Module._compile (internal/modules/cjs/loader.js:799:30)
4 verbose stack     at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
4 verbose stack     at Module.load (internal/modules/cjs/loader.js:666:32)
4 verbose stack     at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
4 verbose stack     at Function.Module._load (internal/modules/cjs/loader.js:598:3)
4 verbose stack     at Module.require (internal/modules/cjs/loader.js:705:19)
4 verbose stack     at require (internal/modules/cjs/helpers.js:14:16)
4 verbose stack     at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/graceful-fs.js:3:27)
5 verbose cwd /home/michael
6 error Linux 4.15.0-46-generic
7 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "npm"
8 error node v11.12.0
9 error npm  v3.6.0
10 error internalBinding is not defined
11 error If you need help, you may report this error at:
11 error     <https://github.com/npm/npm/issues>
12 verbose exit [ 1, true ]

1 个答案:

答案 0 :(得分:0)

输入:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

然后选择正确的nodejs版本:

nvm install 11

还可以清除配置:

sudo chown -R $USER:$(id -gn $USER) /home/[username]/.config