-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NVM is not compatible with the npm config "prefix" option warning (Mac OS) + npm ERR! code ELIFECYCLE npm ERR! errno 11 npm ERR! Exit status 11 #1873
Comments
The prefix definitely needs to be deleted fro the npmrc file; other than that, what happens (without nvm) if you run |
I've removed the prefix entirely from the npmrc file, this now tracks node versions correctly when switching between versions via nvm
|
Sounds resolved; happy to reopen if not. |
Yeah @ljharb please could this be reopened as still getting the issue |
@sbarrett08 sure! so with the prefix removed, you're still having trouble running |
It's not running Fairly certain it's not my npm commands or bash scripts that are the cause as they are basically just bash script commands which all work fine using independent execution. There are commands which execute a bash script |
ahhh - if you're running a bash script, it has to either inherit the PATH or re-source |
Yes for example we have one command
I can run the |
|
Can you share the contents of |
Forgive my ignorance in these areas i'm a junior and still trying to pick things up in respect of node etc. that script makes no reference to nvm.sh that i can see but are you saying that because of the script being called via npm it would need something additional to enable it to execute? The only source the script goes to in terms of contents is the bash profile to pick up some db params for host, port, username, pwd etc, should there be something else in the bash profile regarding the Path? In the package.json i have an alias for some commands, these two aliases for example are combined into one command
I can run |
Unfortunately i'm restricted to what i'm allowed to share so i'm trying to redact as much as possible to keep within limits |
Instead of using |
I don't think the script is the issue as there are other members on the team using nvm working on this particular module with the npm commands executing successfully and don't experience the same issue i get, nor have they ever seen this type of error before 😕 |
When i have ran the |
Hmm, i see the proper nvm path there shadowing your system node. In the script environment, what do these commands output? |
|
When i added those commands to the script the above was the output, same as previous |
Is your home directory a symlink? What shell are you using? |
I'm not sure, symlink it's possible, any advice how can i check that? I may have had to do something with that when i was trying to resolve earlier issues. Shell is bash, Mac OS |
@ljharb Would removing an reinstalling nvm be an option to try? |
@sbarrett08 it's certainly worth a shot. |
Tried removing via the README uninstall option, reinstalled and still have the same issue :( |
Just ran another
|
So, to reiterate:
Between your machine and a coworker's where it works - are there any differences in |
Hi,
nvm is working fine on the shell and in npm run-scripts where the npm command contains only one action, where an npm run-script command contains one action plus && a reference to another npm command the issue occurs.
Correct
Not quite as per first point if npm run-script command has only once action, this works fine
correct My co-workers and the Some slight edits out for secure bits. There is also a different node version in play on my colleagues machine but even why i use that version the error i get is the same. I only raised the issue over on npm to try and work the problem from both ends just in case there could have been an overlap, many thanks for your help :) |
aha, |
My bash profile doesn't have much in it, only a few api keys, some mongoDB params exported like I have these exports for some java stuff: The only reference to nvm in the bash_profile is what gets added to the bash profile from the readme: When i've opened a new terminal window there does seem to be node already active but it is the latest version of node installed as default via nvm, not explicitly invoked. |
Sourcing nvm.sh (via sourcing bash_profile) would re-use a potentially different version of node; on this case, 10.8 instead of 9.8. tbh I’d recommend not relying on bash_profile in the script, but instead having it source a different .sh file. |
It's not really an option for me to change this particular script as it's in use by all members of the team and works successfully for them. I think it's something somewhere in my mac that is causing this but aint got no clue where or what. You mentioned before about a symlink, how could i check for this? When i've removed nvm from my system and installed node via brew the issue obviously is no longer present and everything works as expected. With nvm installed I've removed all versions of node but one (6.11.1) so this should prevent the suggestion of different versions of node being re-used but the error is still present. There is a |
Are there any sort of preferences files or group user permissions somewhere that could be potential to look at? |
Not that i can think of - I’d compare home dir file structures and permissions, env vars, profile files, with a coworker for whom it works, and see what differences pop up. |
I'm having the same issue. It seems to be related to the fact that I recently updated In iterm, I have this: ~ $ node --version
v10.9.0
~ $ nvm version
v10.9.0 But then I run
In tmux, here's what the following commands display: ~ $ node --version
v9.7.1
~ $ nvm --version
0.33.11
~ $ nvm version
system
~ $ nvm ls default
v10.9.0 |
@everdimension i believe this often happens in tmux if you're copying PATH variables, but changing them, as part of initializing tmux. Do you have anything in your tmux configs that might be doing this? |
Thank you for replying so quickly. Well, my tmux config has been unchanged for some time, and as far as I can tell there's only this line that interacts with PATH somehow: set-option -g default-command "reattach-to-user-namespace -l zsh" I'm also using both zsh and oh-my-zsh, their configs have been untouched for some time as well. I have found this issue: #1652 The workaround from the first post helps, I have added this line PATH="/usr/local/bin:$(getconf PATH)" just before the line where I source nvm: source $HOME/.nvm/nvm.sh But as I understand it it's just a workaround and |
I can't imagine what would have changed in nvm that could affect this :-/ |
Couldn't resolve, had to give up and hopefully after a device wipe and reset it should be resolved. |
My solution: Completely uninstall any node and node-related things (like nvm, node_moduls, $PATH vars...) on your computer including man files, packages, etc. I then FIRST installed nvm again, and with nvm I installed various node version. |
What fixed this error for me, finally, after trying everything: Uninstall npm. Most important: In /usr/local/bin, delete the Now it's finding the NVM default alias first, not whatever I installed via Xcode. |
In my case I'm using a fresh install (no previous npm or node installation), and zsh, seems this line cause the problem: |
@ignaciocaamanio what is the value of |
Sorry, I don't understand, you mean with what I replaced "$HOME/.nvm" ? |
What I mean is, what is the exact value of the environment variable "HOME" - since i'd expect it to be equivalent to |
It is |
That definitely doesn't make sense. Are you sure that's the value of it on the line immediately before the |
I put |
i'm not sure what to do about that then - your fix shouldn't have been necessary, unless your shell itself is broken ¯\_(ツ)_/¯ |
Sorry to post another comment, @ljharb the nvm installation adds |
@ignaciocaamanio |
Edit: scratch that, still have the issue when using Using the following fixed this issue for me:
|
Is that bug fixed? I have tried the following js: // test.js
console.log(require('child_process').execSync('. ~/.nvm/nvm.sh && nvm list', {encoding: 'utf8'})); It's ok when running with node directly, but if I try to run with npm, it throws the following error:
How to solve this? And my NVM version is 0.33.11, and there is no problems when downgrading to 0.33.2 |
It should be, but nvm v0.33.11 is wildly out of date; upgrade to v0.35.2. |
v0.35.2 has fixed it, thx |
I have the same problem with vscode terminal (zsh) `➜ nvm use Error: Cannot find module '"/Users/infante/Library/Application' |
MAC OS High Siera 10.13.4
nvm debug
output:nvm ls
output:nvm
? (e.g. install script in readme, Homebrew):Install script in readme
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
command -v nvm
added to bash profile:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
I'd had some node/npm permissions issues due to a local node install in the root directory. Removed that and then got nvm to avoid the issues going forward. When trying to run some scripts in a project to restore a mongoDB schema which was working fine until this point i'm now getting the following error:
running
unset npm_config_prefix
has no impact, have also removed the prefix from the~/.npmrc
file in case a preset issue existed.I expected the DB to restored as normal with no npm/nvm errors
.bashrc
,.bash_profile
,.zshrc
, etc) that modifies thePATH
?Yes:
The text was updated successfully, but these errors were encountered: