Questions and errors while following CLI installation instructions



  • I don’t know much about JavaScript or package managers, but I think Quatar looks cool and I want to try it out. I started following the instructions at https://quasar.dev/quasar-cli/installation – here’s a noob’s perpective on them and at the end a question about how to complete the installation:

    First of all, it says “make sure that you have Node >=10 and NPM >=5 installed on your machine”, but it doesn’t say how I check that or how I install or upgrade Node or NPM. After some googling, I found out that I should type this to check:

    node -v
    npm -v
    

    For both, the output was -bash: npm: command not found, so in other words they were not installed on my computer. I then googled “install npm” and arrived at https://www.npmjs.com/get-npm, where I clicked the button labeled “Download Node.js and npm”. On the next page I clicked the LTS version button, and then initiated the installation by opening the downloaded .pkg file.

    At the end of the installation, the installer said “Make sure that /usr/local/bin is in your $PATH.” I had no idea how to check that or how to add it if it was missing, so once again I turned to Google and then ran

    echo $PATH
    

    and saw that /usr/local/bin was included in the output. Actually I also read somewhere that it’s included in macOS by default since a couple of major versions back. I was also wondering how to add it if it was missing and found a Stack Overflow question about this specific Node.js case with 107 upvotes, so I was far from the only one wondering about this.

    Then, following the instructions over at https://www.npmjs.com/get-npm, I ran

    npm install npm@latest -g
    

    and got a list of warnings about npm missing write access to /usr/local/lib/node_modules and its subfolders. I also got a list of errors that also seemed to be about this permissions issue. I then ran sudo npm install npm@latest -g instead, and that seemed to work.

    Onto Quasar CLI! I now ran

    npm install -g @quasar/cli
    

    and got the warnings

    npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
    npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
    

    followed by the same bunch of errors as when I tried to install the latest NPM. So I googled again and found out that I should run

    sudo chown -R $USER /usr/local/lib/node_modules
    

    Okay, so after doing that I ran npm install -g @quasar/cli again, and now the permission denied warning and related errors were gone. However, now there is a long list of new errors, and I’m stuck:

    npm ERR! code EACCES
    npm ERR! syscall symlink
    npm ERR! path ../lib/node_modules/@quasar/cli/bin/quasar
    npm ERR! dest /usr/local/bin/quasar
    npm ERR! errno -13
    npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/@quasar/cli/bin/quasar' -> '/usr/local/bin/quasar'
    npm ERR!  [OperationalError: EACCES: permission denied, symlink '../lib/node_modules/@quasar/cli/bin/quasar' -> '/usr/local/bin/quasar'] {
    npm ERR!   cause: [Error: EACCES: permission denied, symlink '../lib/node_modules/@quasar/cli/bin/quasar' -> '/usr/local/bin/quasar'] {
    npm ERR!     errno: -13,
    npm ERR!     code: 'EACCES',
    npm ERR!     syscall: 'symlink',
    npm ERR!     path: '../lib/node_modules/@quasar/cli/bin/quasar',
    npm ERR!     dest: '/usr/local/bin/quasar'
    npm ERR!   },
    npm ERR!   errno: -13,
    npm ERR!   code: 'EACCES',
    npm ERR!   syscall: 'symlink',
    npm ERR!   path: '../lib/node_modules/@quasar/cli/bin/quasar',
    npm ERR!   dest: '/usr/local/bin/quasar'
    npm ERR! }
    

    How do I continue?

    I’m on macOS Mojave 10.14.6 and my Node.js and NPM version are now 12.18.3 and 6.14.7 respectively.



  • Okay, now I found out that this is the very reason why you should install Node.js and NPM via NVM. I have no idea what NVM really is, but this worked:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
    

    And after relaunch of Terminal:

    nvm install stable
    npm install -g @quasar/cli
    

    So I think those are the steps that you should have in your instructions instead of just

    npm install -g @quasar/cli

Log in to reply