installing npm modules on ubuntu gives me an error











up vote
0
down vote

favorite












i got the following error when i tried to install an npm package called sharp.



sudo npm install -g sharp

> sharp@0.21.0 install /usr/local/lib/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.0/libvips-8.7.0-linux-x64.tar.gz
ERR! sharp EACCES: permission denied, open '/usr/local/lib/node_modules/sharp/19229-libvips-8.7.0-linux-x64.tar.gz'
ERR! sharp Please see http://sharp.pixelplumbing.com/page/install
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/areahints/.node-gyp/8.10.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/sharp/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/sharp/.node-gyp'
gyp ERR! System Linux 4.15.0-39-lowlatency
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/sharp
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.21.0 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.21.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! /home/areahints/.npm/_logs/2018-11-18T16_14_58_685Z-debug.log


running the same code without sudo throws a different error



npm install -g sharp
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access '/usr/local/lib/node_modules'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).


I have similar issues with node-expat, iconv and libxmljs. I have tried installing all dependencies and dev-dependencies and retried to no avail.










share|improve this question






















  • See: stackoverflow.com/a/26825428/5534788
    – lependu
    Nov 18 at 17:28










  • Possible duplicate of How to npm install global not as root?
    – jakerella
    Nov 18 at 17:31















up vote
0
down vote

favorite












i got the following error when i tried to install an npm package called sharp.



sudo npm install -g sharp

> sharp@0.21.0 install /usr/local/lib/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.0/libvips-8.7.0-linux-x64.tar.gz
ERR! sharp EACCES: permission denied, open '/usr/local/lib/node_modules/sharp/19229-libvips-8.7.0-linux-x64.tar.gz'
ERR! sharp Please see http://sharp.pixelplumbing.com/page/install
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/areahints/.node-gyp/8.10.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/sharp/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/sharp/.node-gyp'
gyp ERR! System Linux 4.15.0-39-lowlatency
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/sharp
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.21.0 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.21.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! /home/areahints/.npm/_logs/2018-11-18T16_14_58_685Z-debug.log


running the same code without sudo throws a different error



npm install -g sharp
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access '/usr/local/lib/node_modules'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).


I have similar issues with node-expat, iconv and libxmljs. I have tried installing all dependencies and dev-dependencies and retried to no avail.










share|improve this question






















  • See: stackoverflow.com/a/26825428/5534788
    – lependu
    Nov 18 at 17:28










  • Possible duplicate of How to npm install global not as root?
    – jakerella
    Nov 18 at 17:31













up vote
0
down vote

favorite









up vote
0
down vote

favorite











i got the following error when i tried to install an npm package called sharp.



sudo npm install -g sharp

> sharp@0.21.0 install /usr/local/lib/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.0/libvips-8.7.0-linux-x64.tar.gz
ERR! sharp EACCES: permission denied, open '/usr/local/lib/node_modules/sharp/19229-libvips-8.7.0-linux-x64.tar.gz'
ERR! sharp Please see http://sharp.pixelplumbing.com/page/install
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/areahints/.node-gyp/8.10.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/sharp/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/sharp/.node-gyp'
gyp ERR! System Linux 4.15.0-39-lowlatency
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/sharp
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.21.0 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.21.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! /home/areahints/.npm/_logs/2018-11-18T16_14_58_685Z-debug.log


running the same code without sudo throws a different error



npm install -g sharp
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access '/usr/local/lib/node_modules'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).


I have similar issues with node-expat, iconv and libxmljs. I have tried installing all dependencies and dev-dependencies and retried to no avail.










share|improve this question













i got the following error when i tried to install an npm package called sharp.



sudo npm install -g sharp

> sharp@0.21.0 install /usr/local/lib/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.7.0/libvips-8.7.0-linux-x64.tar.gz
ERR! sharp EACCES: permission denied, open '/usr/local/lib/node_modules/sharp/19229-libvips-8.7.0-linux-x64.tar.gz'
ERR! sharp Please see http://sharp.pixelplumbing.com/page/install
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/areahints/.node-gyp/8.10.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/sharp/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/sharp/.node-gyp'
gyp ERR! System Linux 4.15.0-39-lowlatency
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/sharp
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.21.0 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.21.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! /home/areahints/.npm/_logs/2018-11-18T16_14_58_685Z-debug.log


running the same code without sudo throws a different error



npm install -g sharp
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access '/usr/local/lib/node_modules'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).


I have similar issues with node-expat, iconv and libxmljs. I have tried installing all dependencies and dev-dependencies and retried to no avail.







node.js ubuntu npm






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 18 at 16:50









Kenechukwu

66




66












  • See: stackoverflow.com/a/26825428/5534788
    – lependu
    Nov 18 at 17:28










  • Possible duplicate of How to npm install global not as root?
    – jakerella
    Nov 18 at 17:31


















  • See: stackoverflow.com/a/26825428/5534788
    – lependu
    Nov 18 at 17:28










  • Possible duplicate of How to npm install global not as root?
    – jakerella
    Nov 18 at 17:31
















See: stackoverflow.com/a/26825428/5534788
– lependu
Nov 18 at 17:28




See: stackoverflow.com/a/26825428/5534788
– lependu
Nov 18 at 17:28












Possible duplicate of How to npm install global not as root?
– jakerella
Nov 18 at 17:31




Possible duplicate of How to npm install global not as root?
– jakerella
Nov 18 at 17:31












1 Answer
1






active

oldest

votes

















up vote
0
down vote













It looks like the issue is you do not have permissions.



sudo chown -R areahints /home/areahints && sudo chmod -R 777 /home/areahints


repeat this step for any directory it says you do not have permissions on ^



sudo apt-get update –fix-missing
sudo dpkg –configure -a
sudo apt-get install -f


This should help repair broken packages and install missing dependencies ^



sudo apt-get update
sudo apt-get upgrade
sudo apt-get update
sudo apt-get autoremove


this should be done before you install anything and also after ^



did you upgrade to 18.04 from another distro or was this a fresh install? i am asking this because sometimes there are conflicts when upgrading. it's always best to do a fresh OS install when it's a new distro.



this is the root of the issues you are having on your other question






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53363265%2finstalling-npm-modules-on-ubuntu-gives-me-an-error%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    It looks like the issue is you do not have permissions.



    sudo chown -R areahints /home/areahints && sudo chmod -R 777 /home/areahints


    repeat this step for any directory it says you do not have permissions on ^



    sudo apt-get update –fix-missing
    sudo dpkg –configure -a
    sudo apt-get install -f


    This should help repair broken packages and install missing dependencies ^



    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get update
    sudo apt-get autoremove


    this should be done before you install anything and also after ^



    did you upgrade to 18.04 from another distro or was this a fresh install? i am asking this because sometimes there are conflicts when upgrading. it's always best to do a fresh OS install when it's a new distro.



    this is the root of the issues you are having on your other question






    share|improve this answer

























      up vote
      0
      down vote













      It looks like the issue is you do not have permissions.



      sudo chown -R areahints /home/areahints && sudo chmod -R 777 /home/areahints


      repeat this step for any directory it says you do not have permissions on ^



      sudo apt-get update –fix-missing
      sudo dpkg –configure -a
      sudo apt-get install -f


      This should help repair broken packages and install missing dependencies ^



      sudo apt-get update
      sudo apt-get upgrade
      sudo apt-get update
      sudo apt-get autoremove


      this should be done before you install anything and also after ^



      did you upgrade to 18.04 from another distro or was this a fresh install? i am asking this because sometimes there are conflicts when upgrading. it's always best to do a fresh OS install when it's a new distro.



      this is the root of the issues you are having on your other question






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        It looks like the issue is you do not have permissions.



        sudo chown -R areahints /home/areahints && sudo chmod -R 777 /home/areahints


        repeat this step for any directory it says you do not have permissions on ^



        sudo apt-get update –fix-missing
        sudo dpkg –configure -a
        sudo apt-get install -f


        This should help repair broken packages and install missing dependencies ^



        sudo apt-get update
        sudo apt-get upgrade
        sudo apt-get update
        sudo apt-get autoremove


        this should be done before you install anything and also after ^



        did you upgrade to 18.04 from another distro or was this a fresh install? i am asking this because sometimes there are conflicts when upgrading. it's always best to do a fresh OS install when it's a new distro.



        this is the root of the issues you are having on your other question






        share|improve this answer












        It looks like the issue is you do not have permissions.



        sudo chown -R areahints /home/areahints && sudo chmod -R 777 /home/areahints


        repeat this step for any directory it says you do not have permissions on ^



        sudo apt-get update –fix-missing
        sudo dpkg –configure -a
        sudo apt-get install -f


        This should help repair broken packages and install missing dependencies ^



        sudo apt-get update
        sudo apt-get upgrade
        sudo apt-get update
        sudo apt-get autoremove


        this should be done before you install anything and also after ^



        did you upgrade to 18.04 from another distro or was this a fresh install? i am asking this because sometimes there are conflicts when upgrading. it's always best to do a fresh OS install when it's a new distro.



        this is the root of the issues you are having on your other question







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 at 11:56









        daniela-idara

        419




        419






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53363265%2finstalling-npm-modules-on-ubuntu-gives-me-an-error%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            RAC Tourist Trophy