2017-09-15 180 views
11

在一個MacBook配備的NodeJS的最新版本,我試圖更新NPM:NPM: 「找不到模塊內部/錯誤」

npm install [email protected] 

的錯誤信息是:

npm ERR: code MODULE_NOT_FOUND 
npm ERR: Cannot find module 'internal/errors' 
npm ERR: A complete log of this run can be found in: 
npm ERR:  /Users/alexander/.npm/_logs/2017_09_15_12_35_47_079Z-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 '[email protected]' ] 
2 info using [email protected] 
3 info using [email protected] 
4 verbose npm-session 5db7f116200ca64c 
5 verbose stack Error: Cannot find module 'internal/errors' 
5 verbose stack  at Function.Module._resolveFilename (module.js:527:15) 
5 verbose stack  at Function.Module._load (module.js:476:23) 
5 verbose stack  at Module.require (module.js:568:17) 
5 verbose stack  at require (internal/module.js:11:18) 
5 verbose stack  at evalmachine.<anonymous>:36:16 
5 verbose stack  at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/cmd-shim/node_modules/graceful-fs/fs.js:11:1) 
5 verbose stack  at Module._compile (module.js:624:30) 
5 verbose stack  at Object.Module._extensions..js (module.js:635:10) 
5 verbose stack  at Module.load (module.js:545:32) 
5 verbose stack  at tryModuleLoad (module.js:508:12) 
5 verbose stack  at Function.Module._load (module.js:500:3) 
5 verbose stack  at Module.require (module.js:568:17) 
5 verbose stack  at require (internal/module.js:11:18) 
5 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 stack  at Module._compile (module.js:624:30) 
5 verbose stack  at Object.Module._extensions..js (module.js:635:10) 
6 verbose cwd /Users/alexander/Documents/Source/Repos 
7 verbose Darwin 16.7.0 
8 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "[email protected]" 
9 verbose node v8.5.0 
10 verbose npm v5.3.0 
11 error code MODULE_NOT_FOUND 
12 error Cannot find module 'internal/errors' 
13 verbose exit [ 1, true ] 

在windows計算機上工作正常。

什麼問題,我該如何解決這個問題?

回答

3

嘗試從包中節點v6.11.3LTS重新安裝NPM,然後

嘗試更新到最新的NPM v5.4.2

npm install [email protected] -g

,然後更新到最新的節點V8.3.0

npm install [email protected] -g

6

我有同樣的問題,上面的回答沒有工作。

我在node_modules中有舊版本。

我只是在node_modules刪除一切,然後跑:

npm install [email protected] -g

+2

我不能什麼也沒有運行NPM它拋出一個錯誤C:\用戶\ pirat> NPM module.js:529 扔走錯了路。 ^ 錯誤:無法找到模塊'內部/錯誤' – Xvegas

2

我有同樣的問題,我解決它:

  1. 卸載節點和故宮,做的this answer

  2. 然後安裝節點

    brew install node 
    

    和故宮也將安裝。

相關問題