无法安装node-sass,因为未找到mkdirp

时间:2019-01-14 16:13:16

标签: npm node-sass

我收到找不到模块'mkdirp'的错误。

我安装了它,它在package.json中列出:     "mkdirp": "^0.5.1"

dev@b7ee560044f1:~/project$ npm i -D node-sass@4.5.3

> node-sass@4.5.3 install /home/dev/project/node_modules/node-sass
> node scripts/install.js

module.js:550
    throw err;
    ^

Error: Cannot find module 'mkdirp'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/dev/volume/cache/front-node-modules/node-sass/scripts/install.js:7:11)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/webpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.5.3 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.5.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dev/.npm/_logs/2019-01-14T16_08_27_969Z-debug.log
dev@b7ee560044f1:~/project$ npm i -D node-sass@4.5.3

为什么会发生此错误? 我不明白npm的工作原理...

1 个答案:

答案 0 :(得分:0)

好,首先尝试安装此软件包的最新版本,然后再次尝试安装node-sass。

因此运行此npm install mkdirp@latest,然后重试。

那行吗?