依赖安装踩坑记录

158 阅读1分钟

Error: Can't find Python executable "python", you can set the PYTHON env var

解决方案

  • 用管理员权限执行npm install --global --production windows-build-tools,运行完毕后会停留在Successfully installed Python 2.7,此时不要终止
  • 在安装过程中会打印出一个c盘的路径,里面有Python的msi安装包,找到这个包运行之后选择remove
  • remove之后,重新运行安装包默认安装,安装完毕之后,就可以回到命令行ctrl + c终止命令
  • 重新执行npm install即可

Can't import the named export 'xxx' from non EcmaScript module (only default export is available)

解决方案

vue.config.js中增加配置如下:

module.exports = {
    configureWebpack: {
        module: {
            rules: [
                {
                    test: /\.mjs$/,
                    include: /node_modules/,
                    type: 'javascript/auto'
                }
            ]
        }
    }
}

cb() never called !

解决方案

nvm卸载当前node,重新安装即可

Uncaught ReferenceError: regeneratorRuntime is not defined

解决方案

  • npm i -D babel-plugin-transform-runtime
  • main.js中首行添加import "regenerator-runtime"

npm WARN tarball tarball data for ... seems to be corrupted. Trying one more time.

解决方案

  • npm cache clean --force
  • 重新指定npm私有源
  • npm install

node-sass提示没有绑定对应的环境变量

解决方案

  • npm rebuild node-sass

堆栈溢出

解决方案

  • 全局安装increase-memory-limitcross-env
  • 新增脚本"fix-memory-limit: "cross-env LIMIT=40960 increase-memory-limit并执行
  • 修改modules/.bin文件夹下的"%_prog%"%_prog%
  • 重新执行npm run serve