简体   繁体   English

将 VueJS 与 Laravel 一起使用 - npm 安装错误

[英]Use VueJS with Laravel – npm install error

I know this question is already asked, But I think my problem is different than the problems described in the already asked questions.我知道这个问题已经被问过了,但我认为我的问题与已经问过的问题中描述的问题不同。

here is the output of npm install command这是 npm install 命令的输出

npm 安装输出

here is the "/root/.npm/_logs/2018-07-12T14_14_35_726Z-debug.log" file这是“/root/.npm/_logs/2018-07-12T14_14_35_726Z-debug.log”文件

3304 silly saveTree | |   |   | +-- pify@2.3.0
3304 silly saveTree | |   |   | `-- strip-bom@3.0.0
3304 silly saveTree | |   |   `-- path-type@2.0.0
3304 silly saveTree | |   +-- which-module@2.0.0
3304 silly saveTree | |   `-- yargs-parser@7.0.0
3304 silly saveTree | `-- yargs@8.0.2
3304 silly saveTree +-- lodash@4.17.10
3304 silly saveTree +-- popper.js@1.14.3
3304 silly saveTree `-- vue@2.5.16
3305 warn ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
3306 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
3307 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3308 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS:    darwin
3308 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch:  any
3308 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS:   linux
3308 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
3309 verbose stack Error: node-sass@4.9.2 postinstall: `node scripts/build.js`
3309 verbose stack Exit status 1
3309 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:304:16)
3309 verbose stack     at emitTwo (events.js:126:13)
3309 verbose stack     at EventEmitter.emit (events.js:214:7)
3309 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
3309 verbose stack     at emitTwo (events.js:126:13)
3309 verbose stack     at ChildProcess.emit (events.js:214:7)
3309 verbose stack     at maybeClose (internal/child_process.js:925:16)
3309 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
3310 verbose pkgid node-sass@4.9.2
3311 verbose cwd /home/amarjit/Documents/localhost/laraveys
3312 verbose Linux 4.15.0-23-generic
3313 verbose argv "/usr/bin/node" "/usr/bin/npm" "install"
3314 verbose node v8.11.3
3315 verbose npm  v6.1.0
3316 error code ELIFECYCLE
3317 error errno 1
3318 error node-sass@4.9.2 postinstall: `node scripts/build.js`
3318 error Exit status 1
3319 error Failed at the node-sass@4.9.2 postinstall script.
3319 error This is probably not a problem with npm. There is likely additional logging output above.
3320 verbose exit [ 1, true ]

I found a solution, I think the issue was regarding permissions of all files in node_modules directory.我找到了一个解决方案,我认为问题在于 node_modules 目录中所有文件的权限。 So I just ran所以我就跑了

sudo chmod -R a+rwx ./node_modules

For me it was installing nodejs-legacy.对我来说,它正在安装 nodejs-legacy。 Type node -v and if that returns an error:输入node -v如果返回错误:

apt install nodejs-legacy

Should do the trick.应该做的伎俩。 Happy coding!快乐编码!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM