2017-05-10 7 views
1

をportfinderをインストールした後、私はターミナルでにサービスを提供NGを使用して、私のターミナルで、このエラーを取得しておくモジュールのportfinder」を見つけることができません得続ける、私はすでにnpm uninstall -g angular-cli, npm cache clean, npm install npm -g, npm install -g angular-cliまた、='npm install portfinderを試してみましたが、どれもの作業と私は保ちますそれを取得して以下のように、私はNPM 3.10.10、Angular4とエラーを使用しています:あなたは、それはまた別の代替の仕事を取得するノードv4.xのを必要とする角度 - 私も手動で

Cannot find module 'portfinder' 
Error: Cannot find module 'portfinder' 
    at Function.Module._resolveFilename (module.js:469:15) 
    at Function.Module._load (module.js:417:25) 
    at Module.require (module.js:497:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (/usr/local/lib/node_modules/angular-cli/commands/serve.js:6:18) 
    at Module._compile (module.js:570:32) 
    at Object.Module._extensions..js (module.js:579:10) 
    at Module.load (module.js:487:32) 
    at tryModuleLoad (module.js:446:12) 
    at Function.Module._load (module.js:438:3) 
    at Module.require (module.js:497:17) 
    at require (internal/module.js:20:19) 
    at Class.includedCommands (/usr/local/lib/node_modules/angular-cli/addon/index.js:21:16) 
    at /usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/models/project.js:392:61 
    at Array.forEach (native) 
    at Project.addonCommands (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/models/project.js:391:15) 
    at Project.eachAddonCommand (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/models/project.js:426:30) 
    at module.exports (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/cli/lookup-command.js:33:13) 
    at CLI.<anonymous> (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/lib/cli/cli.js:34:26) 
    at tryCatch (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/lib/rsvp/-internal.js:215:12) 
    at invokeCallback (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/lib/rsvp/-internal.js:230:13) 
    at publish (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/lib/rsvp/-internal.js:198:7) 
    at flush (/usr/local/lib/node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/lib/rsvp/asap.js:82:5) 
    at _combinedTickCallback (internal/process/next_tick.js:73:7) 
    at process._tickCallback (internal/process/next_tick.js:104:9) 

答えて

1

OK、私の問題は解決しました。問題は、私のコンピュータのダブルノードでした。(これは、なぜportfinderをインストールした後でも、私はまだモジュール 'portfinder'を見つけることができません。ノードを含むすべてのフォルダがクリアされ、この方法は

# first: 
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done 
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* 

# To recap, the best way (I've found) to completely uninstall node + npm is to do the following: 

# go to /usr/local/lib and delete any node and node_modules 
cd /usr/local/lib 
sudo rm -rf node* 

# go to /usr/local/include and delete any node and node_modules directory 
cd /usr/local/include 
sudo rm -rf node* 

# if you installed with brew install node, then run brew uninstall node in your terminal 
brew uninstall node 

# check your Home directory for any "local" or "lib" or "include" folders, and delete any "node" or "node_modules" from there 
# go to /usr/local/bin and delete any node executable 
cd /usr/local/bin 
sudo rm -rf /usr/local/bin/npm 
sudo rm -rf /usr/local/bin/node 
ls -las 

# you may need to do the additional instructions as well: 
sudo rm -rf /usr/local/share/man/man1/node.1 
sudo rm -rf /usr/local/lib/dtrace/node.d 
sudo rm -rf ~/.npm 

ので、私は自作を介してノードをインストールして:私は何をしたか、私は私が見つけ、この方法によるどこでもMy Macで任意のノードフォルダを削除するには、デフォルトで別の場所に設置しますインストール糸、角度cli、反応ネイティブcliなど...

私はこれを共有すると考えていた彼は同じ問題です。

3

角度-cliのフォルダに行くと、そこにportfinderをインストールしていますnpm install portfinderとなります。ローカルのnpmインストールportfinderが問題の解決に失敗した場合、portfinderのグローバルインストールが機能するはずです。

+0

ノードの場合はすでにv6です。 – Alireza

+0

angle-cliフォルダに移動し、npm install portfinderを使用してportfinderをインストールします。 – HarryJs

+0

私もそうしましたが、同じ問題が残っています!とても奇妙... – Alireza

関連する問題