2017-06-02 58 views
0

我運行cmd rm -rf node_modules && npm install,似乎沒有什麼有趣的事情發生。但在那之後,當我運行npm uninstall react-native-router-flux,它開始說找不到模塊緩衝墊片「npm install --save」cmd表示無法找到緩衝墊片之後我「rm -rf node_modules && npm install」

我發現,從現在起,每當我npm install --save something或「npm uninstall --save something: 它給出了這樣的錯誤:

[email protected] should be installed with -g 

> [email protected] 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 [email protected] should be installed with -g 

> [email protected] 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,這當然可以追溯到第一proble (再也找不到緩衝墊片)

我試過npm install -g buffer-shimsnpm link buffer-shims 但它沒有解決問題。

NPM版本:V5.0.1,節點版本:7.0.0

+0

會發生什麼 – dhershman

+0

@TimeDead NPM我的作品,但它並沒有安裝緩衝墊片對我來說 –

+0

所以它看起來像'npm我'工作,但是每當你運行命令中的選項'npm'它會拋出所有這些錯誤? 編輯(因爲我意外地進入):你可能想嘗試重新安裝你的節點/ npm聽起來像某些事情可能已經得到corror – dhershman

回答

1

這是遷移到NPM 5

後淋巴結薩斯發生的問題,這些命令使其爲我工作:

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

來源:如果你只是用`NPM i`(`NPM install`)https://github.com/sass/node-sass/issues/1991