我使用 Laradock 创建了一个 Laravel 项目。当我运行 npm install 时,我得到以下输出。
> node-sass@4.9.0 install /var/www/npmtest/node_modules/node-sass
> node scripts/install.js
fs.js:119
throw err;
^
Error: EINVAL: invalid argument, open '/var/www/npmtest/node_modules/node-sass/package.json'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:348:35)
at Object.Module._extensions..json (internal/modules/cjs/loader.js:719:20)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/var/www/npmtest/node_modules/node-sass/lib/extensions.js:7:9)
at Module._compile (internal/modules/cjs/loader.js:702:30)
npm WARN rollback Rolling back is-fullwidth-code-point@1.0.0 failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/npmtest/node_modules/gauge/node_modules/is-fullwidth-code-point'
npm WARN rollback Rolling back is-fullwidth-code-point@1.0.0 failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/npmtest/node_modules/sass-graph/node_modules/is-fullwidth-code-point'
npm WARN rollback Rolling back chalk@1.1.3 failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/npmtest/node_modules/node-sass/node_modules/chalk'
npm WARN rollback Rolling back string-width@1.0.2 failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/npmtest/node_modules/gauge/node_modules/string-width'
npm WARN rollback Rolling back chalk@1.1.3 failed (this is probably harmless): ENOTEMPTY: directory not empty, rmdir '/var/www/npmtest/node_modules/har-validator/node_modules/chalk'
npm WARN rollback Rolling back assert-plus@1.0.0 failed (this is probably
……………………
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (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.9.0 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.9.0 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! /root/.npm/_logs/2018-06-22T04_51_41_566Z-debug.log
基本上它无法运行 npm install 命令。如果我在 docker 之外创建 Laravel 项目,它会完美运行。有人知道为什么吗?