V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
labikekoko
V2EX  ›  Node.js

centos 下 npm isntall 遇到了 node-sass 报错?

  •  
  •   labikekoko · 2019-01-03 22:03:16 +08:00 · 5789 次点击
    这是一个创建于 2143 天前的主题,其中的信息可能已经有所发展或是发生改变。

    npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.

    [email protected] install /developer/git-repo/shop-backend/node_modules/node-sass node scripts/install.js

    Unable to save binary /developer/git-repo/shop-backend/node_modules/node-sass/vendor/linux-x64-64 : { Error: EACCES: permission denied, mkdir '/developer/git-repo/shop-backend/node_modules/node-sass/vendor' at Object.mkdirSync (fs.js:753:3) at sync (/developer/git-repo/shop-backend/node_modules/mkdirp/index.js:71:13) at Function.sync (/developer/git-repo/shop-backend/node_modules/mkdirp/index.js:77:24) at checkAndDownloadBinary (/developer/git-repo/shop-backend/node_modules/node-sass/scripts/install.js:114:11) at Object.<anonymous> (/developer/git-repo/shop-backend/node_modules/node-sass/scripts/install.js:157:1) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) errno: -13, syscall: 'mkdir', code: 'EACCES', path: '/developer/git-repo/shop-backend/node_modules/node-sass/vendor' }</anonymous>

    [email protected] postinstall /developer/git-repo/shop-backend/node_modules/uglifyjs-webpack-plugin node lib/post_install.js

    [email protected] postinstall /developer/git-repo/shop-backend/node_modules/node-sass node scripts/build.js

    Building: /usr/local/node-v10.15.0-linux-x64/bin/node /developer/git-repo/shop-backend/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= gyp info it worked if it ends with ok gyp verb cli [ '/usr/local/node-v10.15.0-linux-x64/bin/node', gyp verb cli '/developer/git-repo/shop-backend/node_modules/node-gyp/bin/node-gyp.js', gyp verb cli 'rebuild', gyp verb cli '--verbose', gyp verb cli '--libsass_ext=', gyp verb cli '--libsass_cflags=', gyp verb cli '--libsass_ldflags=', gyp verb cli '--libsass_library=' ] gyp info using [email protected] gyp info using [email protected] | linux | x64 gyp verb command rebuild [] gyp verb command clean [] gyp verb clean removing "build" directory gyp verb command configure [] gyp verb check python checking for Python executable "python2" in the PATH gyp verb which succeeded python2 /usr/bin/python2 gyp verb check python version /usr/bin/python2 -c "import sys; print "2.7.5 gyp verb check python version .%s.%s" % sys.version_info[:3];" returned: %j gyp verb get node dir no --target version specified, falling back to host node version: 10.15.0 gyp verb command install [ '10.15.0' ] gyp verb install input version string "10.15.0" gyp verb install installing version: 10.15.0 gyp verb install --ensure was passed, so won't reinstall if already installed gyp verb install version not already installed, continuing with install 10.15.0 gyp verb ensuring nodedir is created /root/.node-gyp/10.15.0 gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/10.15.0" gyp WARN EACCES attempting to reinstall using temporary dev dir "/developer/git-repo/shop-backend/node_modules/node-sass/.node-gyp" gyp verb tmpdir == cwd automatically will remove dev files after to save disk space gyp verb command install [ '--node_gyp_internal_noretry', '10.15.0' ] gyp verb install input version string "10.15.0" gyp verb install installing version: 10.15.0 gyp verb install --ensure was passed, so won't reinstall if already installed gyp verb install version not already installed, continuing with install 10.15.0 gyp verb ensuring nodedir is created /developer/git-repo/shop-backend/node_modules/node-sass/.node-gyp/10.15.0 gyp WARN install got an error, rolling back install gyp verb command remove [ '10.15.0' ] gyp verb remove using node-gyp dir: /developer/git-repo/shop-backend/node_modules/node-sass/.node-gyp gyp verb remove removing target version: 10.15.0 gyp verb remove removing development files for version: 10.15.0 gyp WARN install got an error, rolling back install gyp verb command remove [ '10.15.0' ] gyp verb remove using node-gyp dir: /developer/git-repo/shop-backend/node_modules/node-sass/.node-gyp gyp verb remove removing target version: 10.15.0 gyp verb remove removing development files for version: 10.15.0 gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/developer/git-repo/shop-backend/node_modules/node-sass/.node-gyp' gyp ERR! System Linux 3.10.0-693.2.2.el7.x86_64 gyp ERR! command "/usr/local/node-v10.15.0-linux-x64/bin/node" "/developer/git-repo/shop-backend/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd /developer/git-repo/shop-backend/node_modules/node-sass gyp ERR! node -v v10.15.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok Build failed with error code: 1 npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

    npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] postinstall: node scripts/build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] postinstall 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/2019-01-03T03_54_00_385Z-debug.log

    6 条回复    2019-01-04 15:19:43 +08:00
    Peikon
        1
    Peikon  
       2019-01-03 22:12:39 +08:00
    没啥原因,就是这玩意儿不好下。。。还有 node-inspector/fsevents/phantomjs 同理
    yuanfnadi
        2
    yuanfnadi  
       2019-01-03 22:42:35 +08:00 via iPhone
    aleviosa
        3
    aleviosa  
       2019-01-04 00:41:09 +08:00
    看 log 说是权限不对啊,lz 检查下 /developer/git-repo/shop-backend 的权限吧
    azh7138m
        4
    azh7138m  
       2019-01-04 00:48:07 +08:00 via Android
    你看 2 楼配置 sass_binary 是 ok 的。
    一般来说,啥配置没有,是会下载源码然后编译的,然后 gyp 这个机制捉急的很,还是配置好 sass_binary 吧。
    hauk0101
        5
    hauk0101  
       2019-01-04 09:15:45 +08:00 via Android
    sudo npm i 可解
    clooooo
        6
    clooooo  
       2019-01-04 15:19:43 +08:00
    翻墙
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2921 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 09:09 · PVG 17:09 · LAX 01:09 · JFK 04:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.