
07-vue打包问题
记录下vue打包遇到的各种各样的问题
本地打包正常,linux环境打包报错Error: Cannot find module @rollup/rollup-linux-x64-gnu
text
Error: Cannot find module @rollup/rollup-linux-x64-gnu. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
package.json 没有关于rollup-linux-x64-gnu的依赖,但是package-lock.json却有相关的依赖,但是我们又不能直接删lock的文件内容。
在package.json中加入以下配置项:
json
{
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "*"
}
}
node_module缓存问题,重新生成package-lock.json文件
shell
rm -rf package-lock.json node_modules
npm install