running the vagrant up on a previously functioning infrastructure fails with the following error
==> default: Error: Command npm is missing
==> default: Error: /Stage[main]/Puphpet_nodejs/Package[express]/ensure: change from absent to present failed: Command npm is missing
Had a look into the responsible script within the VM "/.puphpet-stuff/node_install.sh" and it seems the URL its using to fetch the latest node version is not exists anymore and thats cause this failure.
I found out the correct URL (perhaps changed recently on nodejs.org website and replaced in the file and it works now.
vagrant ssh
sudo vim /.puphpet-stuff/node_install.sh
and change
http://nodejs.org/dist/latest/SHASUMS.txt
To
http://nodejs.org/dist/latest/SHASUMS256.txt
Related
The last week my pipeline works fine, but yesterday it failed caused of npm not found error. The pipeline was not changed since the last time it works well.
I also tried default docker image and other versions of node images, but all get the same error.
I even tried "which npm" and got "bash: npm: command not found", seems no command is available.
$PATH is an environment variable which the shell uses to find commands, but I accidentally defined it again in repository settings, rename $PATH solved the problem.
When I start run npm start, there is error like this.
[npm error screen]
[Debug_log]
debug log is like this
[npm version & node version]
This is my node version and npm version.
[path]
This is PATH.
[HOST]
This is HOST.
I think it's an environmental variable error.
But I don't know what else to try. Please help me.
[The way in which I tried and failed]
[1.conda install gxx_linux-64(Fail)]
[2.change hostname using hostnamectl: fail]
2021.04.04 edit:
[3.execute source. etc/bash.bashrc](partial success:the reason I don't know)
[edit bash.bashrc: HOST="localhost"]Failed
[excute running server]
excute source .bash.bashrc web server running. But exit bash.bashrc, there is still same error
Found solution but I don't know Why this is work
reference
According to Adriaan's answer
(base) is Anaconda's default environment.
When you connect to the CLI environment, the base starts active.
If (base) is active,
So We're going to turn off automatic activation of this virtual environment.
Running $ conda config --set auto_activate_base false
Then the front part that "(base) is disappeared.
If you open a new terminal and operate the server again, the server will work.
[(base) dissapear & Server is running]
[Running command: $ conda config --set auto_activate_base false]
You can see what appears auto_activate_base: false
below the .condarc
I've installed nodejs as described here.
Everything works fine when I ssh to the server myself. But I've created a script that deploys my application and call it via bitbucket pipelines. Everything else works fine (composer install, php artisan migrate etc.), except npm install. The error message is
./deploy: line 26: npm: command not found
In bitbucket-pipelines.yml I call my script like this:
- step:
script:
- ssh user#ip_address ./deploy
When I call the script by myself everything works. The problem is only with bitbucket pipelines. I have no clue why this happens :(.
Running which composer revealed that at least composer command is not getting picked up from your assumed location i.e., ~/composer dir. Instead, it was found in /opt/cpanel/composer/bin/composer.
which npm returned the following:
no npm in (/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt/bin:/opt/cpanel/composer/bin:/home/handmast/.local/bin:/home/handmast/bin)
Now since you are able to manually run the command npm, you just need to figure about the path from where npm is running and ensure that the path is explicitly added to the user's ~/.bashrc file and things should work fine. You need to do this because as per your observation, ssh is not able to find it.
export PATH=$PATH:/path/to/npm/binary
Note: To avoid any confusion, just remember that while adding the path to your binary, you just have to add the path to the directory where npm resides. Don't add npm at the end. For example, following is incorrect way:
export PATH=$PATH:/home/handmast/bin/npm
Correct way is this:
export PATH=$PATH:/home/handmast/bin
Before I start, I want to say that I already checked these answers:
Jenkins build step fails on 'npm install <whatever>'
Jenkin's build failing on npm install
Now, I'm dealing with this issue for a while already and thus I tried a bunch of stuff.
Firstly, I installed node + npm via homebrew. A simple $ node -v and $ npm -v echoed the version v0.10.36 for node and v2.3.* for npm, which also means I HAVE THEM IN THE PATH and they work while called in the terminal.
Simply adding node -v; npm -v to the execute shell in Jenkins didn't do it. After a bit of tinkering I copied what $: which node yielded in the terminal to the above mentioned script, which now looked like this: /usr/local/bin/node and apparently that worked. The Jenkins build succeeded and 'node-v0.10.36' was proudly displayed in the console output.
When doing the same for 'npm' which happened to be /usr/local/bin/npm --version the computing gods weren't so merciful anymore. A big 'env: node: No such file or directory' error was thrown this time and the whole build failed.
The actual command that fails is
$ /bin/sh -xe /var/folders/wr/g_dl81tn5_x0t_yz3jw602cr0000gn/T/hudson8770480548136671253.sh and "surprisingly" when I run the same command in the terminal it succeeds.
I also uninstalled the homebrew node & npm versions and installed them afterwards via the package manager. Same results.
Ultimately I also did this: https://gist.github.com/DanHerbert/9520689, with no luck.
Notes:
I'm running Jenkins 1.613 and tried with 1.5**
I didn't create a "Jenkins" specific user but instead I'm using the admin. This happens to be the same user that Jenkins runs, since the who am i command inside the executable script yields the admin's user name.
sudo'ing doens't help
I'm also running the whole thing in a Virtual Environment - vagrant
I'm not running Jenkins as a deamon, as it's conflicting with xtools, but as a simple process
I also tried out jenkins-node plugin with various configs (can detail if needed)
Thanks a lot for your help, and let me know if you need any other info, screenshots, logs, etc.
I found my own solution. The problem was that the PATH although visible in shell was not exported for the Jenkins job, and so, the first workaround, as found here, was to export it in the actual script like so:
but this feels like a hack!
The right and elegant solution is to use Jenkins EnvInject Plugin and export the path in the added Properties content textarea on the configuration page, like so:
Manage Jenkins -> Configure System -> Global properties -> Environment variables
I have followed these instructions.
And as far as I can tell I have successfully installed node.js azure tools. No error - nothing to suggest it failed.
However, I cannot, and the documentation says, simple run "azure"...
Maybe there is something I am missing with node.js?
There are a few problems you may be experiencing.
First of all, I would ensure you are running Node.js v0.6.20. You can do this by opening the command prompt and running:
node -v
You should have v0.6.20 echoed back.
If this doesn't work, you may be missing a path variable to Node.js or the NPM cache. Verify the Environment variables exist by running [in the command prompt]:
path
you should see two paths:
%appdata%\npm
[x64 Machine]
%programfiles(x86)%\nodejs\
[x86 Machine]
%programfiles%\nodejs\
If this doesn't work, I would check to ensure that the azure module was loaded into the %appdata%\npm\node_modules directory.
It could be the PATH issue. In my case, the azure program is located at ~/.npm-global/bin.
run "export PATH=$PATH:~/.npm-global/bin". Or just add to bash source file