gpt4 book ai didi

javascript - Angular 4 - 即使在手动安装 portfinder 后,我仍然无法找到模块 'portfinder'

转载 作者:行者123 更新时间:2023-11-30 09:35:19 33 4
gpt4 key购买 nike

我在终端中使用 ng serve 在我的终端中不断收到此错误,我已经尝试过 ='npm install portfinder,也 npm uninstall -g angular- cli、npm 缓存清理、npm install npm -g、npm install -g angular-cli,但没有任何效果,我一直在使用它,我使用的是 npm 3.10.10、Angular4,错误如下:

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)

最佳答案

您需要 Node v4.x 才能使其正常工作,另一种选择是转到 angular-cli 文件夹并使用 npm install portfinder 在其中安装 portfinder。如果本地 npm install portfinder 无法解决问题,则全局安装 portfinder 应该可以。

关于javascript - Angular 4 - 即使在手动安装 portfinder 后,我仍然无法找到模块 'portfinder',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43885602/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com