“npm install --save”cmd说我在“rm -rf node_modules&& npm install”之后找不到缓冲区垫片

时间:2017-06-02 14:32:20

标签: node.js ubuntu npm

我运行cmd rm -rf node_modules && npm install,似乎没有什么有趣的事情发生。但在那之后,当我运行npm uninstall react-native-router-flux时,它开始说它找不到模块缓冲区 - 垫片

我发现从现在起每当npm install --save something或“npm uninstall --save something时: 它给出了这个错误:

node-gyp@3.6.0 should be installed with -g

> node-sass@3.13.1 install /home/raymond/IdeaProjects/puppysky/node_modules/node-sass
> node scripts/install.js

module.js:474
    throw err;
    ^

Error: Cannot find module 'buffer-shims'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.Module._load (module.js:420:25)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/raymond/IdeaProjects/puppysky/node_modules/are-we-there-yet/node_modules/readable-stream/lib/_stream_readable.js:33:18)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)

看到错误后,我尝试npm install --save buffer-shims,但它说:

npm WARN prefer global node-gyp@3.6.0 should be installed with -g

> node-sass@3.13.1 install /home/raymond/IdeaProjects/puppysky/node_modules/node-sass
> node scripts/install.js

module.js:474
    throw err;
    ^

Error: Cannot find module 'console-control-strings'
    at Function.Module._resolveFilename (module.js:472:15)
    at Function.Module._load (module.js:420:25)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/raymond/IdeaProjects/puppysky/node_modules/node-sass/node_modules/gauge/plumbing.js:2:22)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)

看到这个后,我尝试npm install --save console-control-strings,这当然又回到了第一个问题(找不到缓冲垫片)

我尝试过npm install -g buffer-shimsnpm link buffer-shims 但它没有解决问题。

npm版本:v5.0.1,节点版本:v7.0.0

1 个答案:

答案 0 :(得分:1)

这是迁移到npm 5后node-sass发生的问题。

这些命令使它对我有用:

rm -rf node_modules
rm package-lock.json
npm cache clean
npm install

来源:https://github.com/sass/node-sass/issues/1991