Node Sass Error: Cannot find module 'mkdirp'

Node Sass Error: Cannot find module 'mkdirp'

我有以下package.json

"devDependencies": {
    "bootstrap-sass": "*",
    "buble": "^0.12.5",
    "css-loader": "^0.25.0",
    "gulp": "*",
    "jquery": "^3.1.0",
    "json-loader": "^0.5.4",
    "laravel-elixir": "^6.0.0-14",
    "laravel-elixir-browsersync-official": "^1.0.0",
    "laravel-elixir-vue-2": "^0.2.0",
    "laravel-elixir-webpack-official": "^1.0.2",
    "lodash": "^4.16.2",
    "sass": "*",
    "sass-loader": "*",
    "vue": "^2.1.10",
    "vue-loader": "^9.7.0",
    "vue-resource": "^1.0.3",
    "vue-router": "^2.0.0",
    "vue-stash": "^2.0.1-beta",
    "vue-template-compiler": "^2.1.10"
  },
  "dependencies": {
    "bootstrap-datepicker": "^1.6.4",
    "jquery-simple-upload": "^1.0.0",
    "json-loader": "^0.5.4",
    "moment": "*",
    "natives": "^1.1.6",
    "vuejs-datepicker": "^0.9.24"
  }

关于使用 Yarn 安装我遇到的模块

warning "laravel-elixir-vue-2 > sass-loader@4.1.1" has unmet peer dependency "webpack@^2 || ^2.2.0-rc.0 || ^2.1.0-beta || ^1.12.6". [4/4] Building fresh packages... error /home/vagrant/Code/xxx/node_modules/node-sass: Command failed. Exit code: 1 Command: node scripts/install.js Arguments: Directory: /home/vagrant/Code/xxx/node_modules/node-sass Output: internal/modules/cjs/loader.js:818 throw err; ^

Error: Cannot find module 'mkdirp' Require stack:

  • /home/vagrant/modules/xxx/node-sass/scripts/install.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15) at Function.Module._load (internal/modules/cjs/loader.js:667:27) at Module.require (internal/modules/cjs/loader.js:887:19) at require (internal/modules/cjs/helpers.js:74:18) at Object. (/home/vagrant/modules/xxx/node-sass/scripts/install.js:7:11) at Module._compile (internal/modules/cjs/loader.js:999:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) at Module.load (internal/modules/cjs/loader.js:863:32) at Function.Module._load (internal/modules/cjs/loader.js:708:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) { code: 'MODULE_NOT_FOUND',
    requireStack: [ '/home/vagrant/modules/xxx/node-sass/scripts/install.js' ]

我不确定为什么/谁在安装 node-sass 但无论我 yarn clean cache rm -rf package.lock.json 还是 rm -rf node_modules

我正在使用

纱线 1.22.10 节点 12.20.0 npm 6.14.9

Linux homestead 4.15.0-124-generic #127-Ubuntu

不确定在哪里安装“mkdirp”。

但你可以先安装mkdirp@latest,

然后让yarn/npm再次安装所有包

看看“mkdirp”是否真的有问题。

yarn add mkdirp@lastest // or npm i mkdirp@lastest

然后

yarn install // or npm i

看起来节点 LTS 是 14.something。

也许尝试更新它(以及其他所有内容)?