Can't install CLI…"user does not have permission to access.."

Added “–unsafe-perm” to the command line as follows:

npm install -g particle-cli --unsafe-perm

I found this solution in github #2952. That thread also mentions a ‘tmp’ file existing which prevents the install from happening although that did not seem relevant to my situation. Hope this helps anyone else trapped in the bottom of the well. I have no idea how this affected the install process!

Now, whether this actually installed the CLI is a different question. But at least this one roadblock is circumvented.

I am using OSX 10.7.5. Ran as root. Output showing the problem symptoms follows:

sh-3.2# npm install -g particle-cli
\
> serialport@2.0.5 install /usr/local/lib/node_modules/particle-cli/node_modules/serialport
> node-pre-gyp install --fallback-to-build

gyp WARN EACCES user "jimhahn" does not have permission to access the dev dir "/var/root/.node-gyp/4.2.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/particle-cli/node_modules/serialport/.node-gyp"
make: *** No rule to make target `../.node-gyp/4.2.4/include/node/common.gypi', needed by `Makefile'.  Stop.
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 11.4.2
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/node-v46-darwin-x64/serialport.node" "--module_name=serialport" "--module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/node-v46-darwin-x64"
gyp ERR! cwd /usr/local/lib/node_modules/particle-cli/node_modules/serialport
gyp ERR! node -v v4.2.4
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/node-v46-darwin-x64/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/node-v46-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/particle-cli/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:818:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Darwin 11.4.2
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/particle-cli/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/particle-cli/node_modules/serialport
node-pre-gyp ERR! node -v v4.2.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.13
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/node-v46-darwin-x64/serialport.node --module_name=serialport --module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/Release/node-v46-darwin-x64' (1)
npm ERR! Darwin 11.4.2
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "particle-cli"
npm ERR! node v4.2.4
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE

npm ERR! serialport@2.0.5 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the serialport@2.0.5 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jimhahn/npm-debug.log

Have you tried it with ‘sudo’ already? Also, could you try npm install -g serial-port?