Error: Cannot find module ‘@rollup/plugin-replace‘

1、错误描述

G:\HBuilderXWork\vue-next>npm run dev

> @3.0.0-rc.5 dev G:\HBuilderXWork\vue-next
> node scripts/dev.js

[!] Error: Cannot find module '@rollup/plugin-replace'
Error: Cannot find module '@rollup/plugin-replace'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:657:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (G:\HBuilderXWork\vue-next\rollup.config.js:9:31)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Object.require.extensions..js (G:\HBuilderXWork\vue-next\node_modules\rollup\dist\bin\rollup:839:24)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)

2、错误原因

     在运行vue3.0源码项目时,出现Error: Cannot find module '@rollup/plugin-replace',由提示可知,是缺少@rollup/plugin-replace依赖模块

3、解决办法

     cnpm install @rollup/plugin-replace

G:\HBuilderXWork\vue-next>cnpm install @rollup/plugin-replace
/ [0/1] Installing fsevents@~2.1.2platform unsupported @rollup/plugin-replace@2.3.3 › rollup@2.23.0 › fsevents@~2.1.2 Pa
ckage require os(darwin) not compatible with your platform(win32)
- [0/1] Installing fsevents@~2.1.2[fsevents@~2.1.2] optional install error: Package require os(darwin) not compatible wi
th your platform(win32)
√ Installed 1 packages
√ Linked 8 latest versions
√ Run 0 scripts
peerDependencies link rollup@2.23.0 in G:\HBuilderXWork\vue-next\node_modules\_@rollup_plugin-replace@2.3.3@@rollup\plug
in-replace unmet with G:\HBuilderXWork\vue-next\node_modules\rollup(1.26.0)
peerDependencies link rollup@2.23.0 in G:\HBuilderXWork\vue-next\node_modules\_@rollup_pluginutils@3.1.0@@rollup\pluginu
tils unmet with G:\HBuilderXWork\vue-next\node_modules\rollup(1.26.0)
√ All packages installed (9 packages installed from npm registry, used 2s, speed 373.4kB/s, json 9(65.85kB), tarball 79
7.46kB)

 

©️2020 CSDN 皮肤主题: 代码科技 设计师:Amelia_0503 返回首页