Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

我的node是用nvm安装的,用户下的npmrc配置文件如下

prefix=F:Programfiles
odejs
ode_modules
pm
registry=https://registry.npm.taobao.org

在用nvm切换后的那个node目录下npmrc文件无配置,

nvm use 12.18.4

切换到node12.18.4 后,在项目文件夹'F:draftdemo06'执行命令

npm i -g webpack

报错

$ npm i -g webpack
npm ERR! code EEXIST
npm ERR! path F:Programfiles
odejs
ode_modules
pm
[email protected]
npm ERR! dest F:Programfiles
odejs
ode_modules
pmparser
npm ERR! EEXIST: file already exists, cmd shim 'F:Programfiles
odejs
ode_modules
pm
[email protected]' -> 'F:Programfiles
odejs
ode_modules
pmparser'
npm ERR! File exists: F:Programfiles
odejs
ode_modules
pmparser
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UserswangmlAppDataRoaming
pm-cache\_logs2020-10-18T08_58_12_166Z-debug.log

并且我也执行了命令

npm i -g gulp

安装成功,但是用gulp -v测试,报错

bash: gulp: command not found

npm 的配置文件如下

$ npm config list
; cli configs
metrics-registry = "https://registry.npm.taobao.org/"
scope = ""
user-agent = "npm/6.14.6 node/v12.18.4 win32 x64"

; userconfig C:Userswangml.npmrc
prefix = "F:\Programfiles\nodejs\node_modules\npm"
registry = "https://registry.npm.taobao.org/"

; node bin location = F:Programfiles
odejs
ode.exe
; cwd = F:draftdemo06
; HOME = C:Userswangml
; "npm config ls -l" to show all defaults.

以上命令操作均在目录F:draftdemo06下进行的,前端小白,求大神解救


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
689 views
Welcome To Ask or Share your Answers For Others

1 Answer

尝试一下以下方法:
1.把 node_modules 文件删除;
2.以管理员方式打开 cmd 窗口;
3.用 cnpm 命令重新安装遍依赖;


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...