Particle-cli unable to reinstall

Hi,
I recently did a npm update -g particle-cli and instead of updating my cli, this command has just deleted my client.
So I tried to reinstall it, but without success.
I’m always getting this error: Failed at the serialport@2.0.1 install script 'node-pre-gyp install --fallback-to-build'.
I tried everything that came to my mind, but nothing was usefull :confused:
Please help me :blush:
Here is my complete error:

> serialport@2.0.1 install /usr/local/lib/node_modules/particle-cli/node_modules/serialport
> node-pre-gyp install --fallback-to-build

(node) child_process: options.customFds option is deprecated. Use options.stdio instead.
make: Entering directory '/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build'
  CXX(target) Release/obj.target/serialport/src/serialport.o
as : option non reconnue « --64 »
serialport.target.mk:92: recipe for target 'Release/obj.target/serialport/src/serialport.o' failed
make: *** [Release/obj.target/serialport/src/serialport.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build'
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/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 Linux 3.19.0-30-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=serialport" "--configuration=Release" "--module_name=serialport" "--version=2.0.1" "--major=2" "--patch=1" "--runtime=node" "--node_abi=node-v46" "--platform=linux" "--target_platform=linux" "--arch=x64" "--target_arch=x64" "--module_main=./serialport" "--host=https://node-serialport.s3.amazonaws.com/" "--module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/serialport/v2.0.1/Release/node-v46-linux-x64" "--remote_path=./serialport/v2.0.1/Release/" "--package_name=node-v46-linux-x64.tar.gz" "--staged_tarball=build/stage/serialport/v2.0.1/Release/node-v46-linux-x64.tar.gz" "--hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/" "--hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/node-v46-linux-x64.tar.gz"
gyp ERR! cwd /usr/local/lib/node_modules/particle-cli/node_modules/serialport
gyp ERR! node -v v4.2.1
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 rebuild --name=serialport --configuration=Release --module_name=serialport --version=2.0.1 --major=2 --patch=1 --runtime=node --node_abi=node-v46 --platform=linux --target_platform=linux --arch=x64 --target_arch=x64 --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/serialport/v2.0.1/Release/node-v46-linux-x64 --remote_path=./serialport/v2.0.1/Release/ --package_name=node-v46-linux-x64.tar.gz --staged_tarball=build/stage/serialport/v2.0.1/Release/node-v46-linux-x64.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/node-v46-linux-x64.tar.gz' (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:76: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 Linux 3.19.0-30-generic
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.1
node-pre-gyp ERR! node-pre-gyp -v v0.5.19
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node rebuild --name=serialport --configuration=Release --module_name=serialport --version=2.0.1 --major=2 --patch=1 --runtime=node --node_abi=node-v46 --platform=linux --target_platform=linux --arch=x64 --target_arch=x64 --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/serialport/v2.0.1/Release/node-v46-linux-x64 --remote_path=./serialport/v2.0.1/Release/ --package_name=node-v46-linux-x64.tar.gz --staged_tarball=build/stage/serialport/v2.0.1/Release/node-v46-linux-x64.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/node-v46-linux-x64.tar.gz' (1)
npm ERR! Linux 3.19.0-30-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "particle-cli"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! serialport@2.0.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the serialport@2.0.1 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!     /home/maxime/npm-debug.log
1 Like

Does it work with nodejs 0.12.x?

Could you try npm install -g serialport, that has worked for me on several occasions?


I mistakenly said serial-port while it should’ve been serialport. Edited accordingly

Thanks for your replies.

@kennethlimcp, with nodejs 0.12.7 here’s what I have

> serialport@2.0.1 install /home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli/node_modules/serialport
> node-pre-gyp install --fallback-to-build

child_process: customFds option is deprecated, use stdio instead.
make: Entering directory '/home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli/node_modules/serialport/build'
  CXX(target) Release/obj.target/serialport/src/serialport.o
as : option non reconnue « --64 »
serialport.target.mk:90: recipe for target 'Release/obj.target/serialport/src/serialport.o' failed
make: *** [Release/obj.target/serialport/src/serialport.o] Error 1



make: Leaving directory '/home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli/node_modules/serialport/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.19.0-31-generic
gyp ERR! command "/home/maxime/.nvm/versions/node/v0.12.7/bin/node" "/home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=serialport" "--configuration=Release" "--module_name=serialport" "--version=2.0.1" "--major=2" "--patch=1" "--runtime=node" "--node_abi=node-v14" "--platform=linux" "--target_platform=linux" "--arch=x64" "--target_arch=x64" "--module_main=./serialport" "--host=https://node-serialport.s3.amazonaws.com/" "--module_path=/home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli/node_modules/serialport/build/serialport/v2.0.1/Release/node-v14-linux-x64" "--remote_path=./serialport/v2.0.1/Release/" "--package_name=node-v14-linux-x64.tar.gz" "--staged_tarball=build/stage/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz" "--hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/" "--hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz"
gyp ERR! cwd /home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli/node_modules/serialport
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/maxime/.nvm/versions/node/v0.12.7/bin/node rebuild --name=serialport --configuration=Release --module_name=serialport --version=2.0.1 --major=2 --patch=1 --runtime=node --node_abi=node-v14 --platform=linux --target_platform=linux --arch=x64 --target_arch=x64 --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=/home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli/node_modules/serialport/build/serialport/v2.0.1/Release/node-v14-linux-x64 --remote_path=./serialport/v2.0.1/Release/ --package_name=node-v14-linux-x64.tar.gz --staged_tarball=build/stage/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:76:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:1015:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
node-pre-gyp ERR! System Linux 3.19.0-31-generic
node-pre-gyp ERR! command "node" "/home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli/node_modules/serialport
node-pre-gyp ERR! node -v v0.12.7
node-pre-gyp ERR! node-pre-gyp -v v0.5.19
node-pre-gyp ERR! not ok 
Failed to execute '/home/maxime/.nvm/versions/node/v0.12.7/bin/node rebuild --name=serialport --configuration=Release --module_name=serialport --version=2.0.1 --major=2 --patch=1 --runtime=node --node_abi=node-v14 --platform=linux --target_platform=linux --arch=x64 --target_arch=x64 --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=/home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli/node_modules/serialport/build/serialport/v2.0.1/Release/node-v14-linux-x64 --remote_path=./serialport/v2.0.1/Release/ --package_name=node-v14-linux-x64.tar.gz --staged_tarball=build/stage/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz' (1)
npm ERR! Linux 3.19.0-31-generic
npm ERR! argv "/home/maxime/.nvm/versions/node/v0.12.7/bin/node" "/home/maxime/.nvm/versions/node/v0.12.7/bin/npm" "install" "-g" "particle-cli"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! serialport@2.0.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the serialport@2.0.1 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!     /home/maxime/npm-debug.log

And @Moors7, for npm install -g serial-port, here it is

npm ERR! Linux 3.19.0-31-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "serial-port"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/serial-port
npm ERR! 404 
npm ERR! 404 'serial-port' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

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

I even tried serialport and this is the error

npm ERR! Linux 3.19.0-31-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "serial-port"
npm ERR! node v4.2.1
npm ERR! npm  v2.14.7
npm ERR! code E404
    
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/serial-port
npm ERR! 404 
npm ERR! 404 'serial-port' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.    
npm ERR! Please include the following file with any support request:
npm ERR!     /home/maxime/npm-debug.log
make: *** [Release/obj.target/serialport/src/serialport.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/serialport/build'
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/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.19.0-31-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=serialport" "--configuration=Release" "--module_name=serialport" "--version=2.0.1" "--major=2" "--patch=1" "--runtime=node" "--node_abi=node-v14" "--platform=linux" "--target_platform=linux" "--arch=x64" "--target_arch=x64" "--module_main=./serialport" "--host=https://node-serialport.s3.amazonaws.com/" "--module_path=/usr/local/lib/node_modules/serialport/build/serialport/v2.0.1/Release/node-v14-linux-x64" "--remote_path=./serialport/v2.0.1/Release/" "--package_name=node-v14-linux-x64.tar.gz" "--staged_tarball=build/stage/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz" "--hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/" "--hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz"
gyp ERR! cwd /usr/local/lib/node_modules/serialport
gyp ERR! node -v v0.12.7
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 rebuild --name=serialport --configuration=Release --module_name=serialport --version=2.0.1 --major=2 --patch=1 --runtime=node --node_abi=node-v14 --platform=linux --target_platform=linux --arch=x64 --target_arch=x64 --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=/usr/local/lib/node_modules/serialport/build/serialport/v2.0.1/Release/node-v14-linux-x64 --remote_path=./serialport/v2.0.1/Release/ --package_name=node-v14-linux-x64.tar.gz --staged_tarball=build/stage/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:76:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:1015:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
node-pre-gyp ERR! System Linux 3.19.0-31-generic
node-pre-gyp ERR! command "node" "/usr/local/lib/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/serialport
node-pre-gyp ERR! node -v v0.12.7
node-pre-gyp ERR! node-pre-gyp -v v0.5.19
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node rebuild --name=serialport --configuration=Release --module_name=serialport --version=2.0.1 --major=2 --patch=1 --runtime=node --node_abi=node-v14 --platform=linux --target_platform=linux --arch=x64 --target_arch=x64 --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=/usr/local/lib/node_modules/serialport/build/serialport/v2.0.1/Release/node-v14-linux-x64 --remote_path=./serialport/v2.0.1/Release/ --package_name=node-v14-linux-x64.tar.gz --staged_tarball=build/stage/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v2.0.1/Release/node-v14-linux-x64.tar.gz' (1)
npm ERR! Linux 3.19.0-31-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "serialport"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! serialport@2.0.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the serialport@2.0.1 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!     /home/maxime/npm-debug.log

BTW, my photon keeps breathing magenta since yesterday, any idea why ? When I flash tinker, that’s good, but when I want to flash my code, he’s going into safe mode.

Breathing magenta means connected to the :cloud: but not running user firmware.

https://docs.particle.io/guide/getting-started/modes/photon/#safe-mode

Sounds like some issue with the firmware you are trying to flash?

hmm npm install -g serialport worked for me…

I tried to flash just this code

void setup()
{
     Serial.begin(9600);
}

void loop()
{
     Serial.println("Hello World!");
}

Hmm, I see you’re on Linux, so you’ll probably need to sudo for any global npm operations.

Have you tried a complete uninstall/reinstall?

sudo npm uninstall -g particle-cli
sudo npm install -g particle-cli

@dougal, I tried sudo with every commands, and when I try to uninstall particle-cli, here is the message:

npm WARN uninstall not installed in /usr/local/lib/node_modules: "particle-cli"

I had a similar problem some time ago but on Windows. I had to delete all the working directories that CLI created before I could reinstall.

@peekay123, every single directory where I used CLI ?

@Maxime, no! I mean the directories create by the installation of CLI. Not sure what those are on linux however.

Okay, i’ll search for them
Thanks @peekay123

1 Like

I deleted them all, but still no change :frowning:

@peekay123, do you have a terminal emulator for me instead of the classic windows cmd.exe please ? I think I’ll move to windows

I noticed that you’re using nvm, and that in one example of your output you’re using node 0.12.7, and in another, you’re using node 4.2.1. Switching between node versions can be pretty problematic, as many of us have discovered.

It looks like 4.2.1 is your “native” version of node, which uses the standard /usr/local/lib/node_modules directory for globally installed modules.

Then with nvm switched to 0.12.7, it’s using /home/maxime/.nvm/versions/node/v0.12.7/lib/node_modules/particle-cli

So you might want to try blowing that directory away, then double-checking which version of node you’re using before trying again?

It looks like this was still invoked with “serial-port” and not “serialport”. Also, as @dougal mentioned, it looks like you are running multiple versions of node through nvm. Could you please try the following:

$ nvm list
       v0.10.40
         v4.1.0
->       v4.1.2
         system

# Make sure v4.x is the current version. If not, run:
$ nvm use v4
Now using node v4.1.2 (npm v2.14.4)

$ npm install -g particle-cli

Now if that still fails for some reason, please post the error.

@dougal, I deleted this folder, and @indraastra, now I have node v4.1.2 and npm v2.14.4 as you indicated, now here is the output message of sudo npm install -g particle-cli

npm WARN install:har-validator@2.0.2 ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/particle-cli/node_modules/serialport/node_modules/node-pre-gyp/node_modules/request/node_modules/har-validator/bin/har-validator'
npm WARN install:node-uuid@1.4.3 ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/particle-cli/node_modules/serialport/node_modules/node-pre-gyp/node_modules/request/node_modules/node-uuid/bin/uuid'
npm WARN install:rimraf@2.2.8 ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/particle-cli/node_modules/serialport/node_modules/node-pre-gyp/node_modules/tar-pack/node_modules/rimraf/bin.js'
/usr/local/lib
└── (empty)

npm ERR! code 1

Thanks for the time you’re according to me and for your help :smile:

ENOENT usually means that a directory is missing… What do these commands give you?

ls -dAFl /usr/local/lib
ls -dAFl /usr/local/lib/node_modules
ls -dAFl /usr/local/lib/node_modules/particle-cli
ls -dAFl /usr/local/lib/node_modules/particle-cli/node_modules
ls -AFl /usr/local/lib/node_modules/particle-cli/node_modules

Also, I’m guessing that there might have been errors earlier in the output? Can you double-check?

It strikes me as odd that even though you are using nvm, things are being installed globally in /usr/local/lib/node_modules. This suggests that somehow you are still using a system-level installation of node/npm being used outside of what nvm provides.

Give these a try and make sure the paths that you see are all relative to your home directory, since the whole point is for multiple versions of node to coexist peacefully without conflicts like you’re seeing:

$ which npm
/Users/[you]/.nvm/versions/node/v4.2.1/bin/npm
# If this path is /usr/local/bin/npm, red flag!

$ nvm install stable
v4.2.1 is already installed.
Now using node v4.2.1 (npm v2.14.7)

$ which npm
/Users/[you]/.nvm/versions/node/v4.2.1/bin/npm
# If you aren't getting something like this, stop here and report back.

$ npm root -g
/Users/[you]/.nvm/versions/node/v4.1.2/lib/node_modules

$ npm install -g particle-cli
-
> serialport@2.0.1 install /Users/[you]/.nvm/versions/node/v4.2.1/lib/node_modules/particle-cli/node_modules/serialport
> node-pre-gyp install --fallback-to-build
...
particle-cli@1.8.13 /Users/[you]/.nvm/versions/node/v4.2.1/lib/node_modules/particle-cli
...

Edit: Ah, sorry, just noticed you’re on Linux, not OSX. Hopefully what I’ve said about things getting installed in your home directory still applies. I’m sure there’s a way to repair your system installation if that’s what’s causing issues, but there’s no need if you get nvm working properly.

simply add --unsafe-perm at the end of npm install command working:

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

Hi @peekay123 … i installed nodejs 4.2.2, and after checking that i started having some problems with particle serial monitor, i uninstalled it, and installed again nodejs v0.10.40 … but when i tried to reinstall particle-cli, i had problems with the serialport issue with a lot of errors … you mention on your post that yu solved this issue by first deleting the folders that the installation of particle-cli created … is that correct?. which are those folders? … very frustrating! thanks!

1 Like