Issues installing vue-cli


#1

I am trying to do a fresh install of vue-cli and have the following already installed,

MacOS Mojave 10.14.2
node v11.6.0
npm 6.6.0-next.0
vue 3.2.3
httpd Server version: Apache/2.4.34 (Unix)
mysql Ver 8.0.13 for macos10.14 on x86_64 (MySQL Community Server - GPL)
phpmyadmin 4.8.4

I am definitely using the latest versions of node and npm.

I am attempting to install vue-cli with,

$ sudo npm install -g @vue/cli

but this returns loads of errors,

    npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
    /usr/local/Cellar/node/11.6.0/bin/vue -> /usr/local/Cellar/node/11.6.0/lib/node_modules/@vue/cli/bin/vue.js
    
    > fsevents@1.2.4 install /usr/local/Cellar/node/11.6.0/lib/node_modules/@vue/cli/node_modules/fsevents
    > node install
    
    node-pre-gyp WARN Pre-built binaries not installable for fsevents@1.2.4 and node@11.6.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp) 
    node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/Cellar/node/11.6.0/lib/node_modules/@vue/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64' 
    gyp ERR! clean error 
    gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
    gyp ERR! System Darwin 18.2.0
    gyp ERR! command "/usr/local/Cellar/node/11.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "clean"
    gyp ERR! cwd /usr/local/Cellar/node/11.6.0/lib/node_modules/@vue/cli/node_modules/fsevents
    gyp ERR! node -v v11.6.0
    gyp ERR! node-gyp -v v3.8.0
    gyp ERR! not ok 
    node-pre-gyp ERR! build error 
    node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)
    node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/Cellar/node/11.6.0/lib/node_modules/@vue/cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
    node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:188:13)
    node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:978:16)
    node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
    node-pre-gyp ERR! System Darwin 18.2.0
    node-pre-gyp ERR! command "/usr/local/Cellar/node/11.6.0/bin/node" "/usr/local/Cellar/node/11.6.0/lib/node_modules/@vue/cli/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd /usr/local/Cellar/node/11.6.0/lib/node_modules/@vue/cli/node_modules/fsevents
    node-pre-gyp ERR! node -v v11.6.0
    node-pre-gyp ERR! node-pre-gyp -v v0.10.0
    node-pre-gyp ERR! not ok 
    Failed to execute '/usr/local/Cellar/node/11.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean' (1)
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/@vue/cli/node_modules/fsevents):
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 install: `node install`
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
    
    + @vue/cli@3.2.3
    updated 1 package in 6.594s

Is there something basic I am missing?

I’ve found out tht this is an issue with node_modules.

The following,

seems to ‘reduce’ the errors substantially.

sudo chown -R $(whoami):staff /usr/local/lib/node_modules

Thanks,


#2

I solved this issue by downgrading from node version v11.6.0 to v10.15.0 and subsequently this downgraded npm from 6.6.0 to 6.4.1 and now everything work fine.