Typescript npm install not working - npm

When I run sudo npm install -g typescript the only thing that gets installed is test3. This is what I get:
$ sudo npm install -g typescript
Password:
test3#1.0.0 /usr/local/lib/node_modules/test3
$ tsc
-bash: tsc: command not found
The Typescript compiler is never installed. I reinstalled node/npm just now to see if it was an install issue, but that didn't seem to fix it. Any ideas?

Related

EACCES: permission denied, open '/Users/stefma/.config/truffle/config.json' after installing Truffle

I tried literally all there is so far and I still can't run truffle macOS 11.6.
that's what I tried after of course first installing it with the command npm install -g truffle:
Downloading command line tools for Xcode and then installing with
sudo npm install -g truffle
sudo npm install --unsafe-perm=true --allow-root truffle
sudo chown myUsername:myUsername -R ~/.config
installing npm and node with nvm all over.
I'd be really grateful for any help
This should work kindly check [YourMacOSUserName] in fir place you MacOSUserName in it and please must rate my effort will be here for any further query.
sudo rm -rf /Users/[YourMacOSUserName]/Library/Preferences/netlify/
npm install -g netlify-cli
sudo ntl login

Gatsby : -bash: gatsby: command not found after npm install

When I try to install gatsby running npm install gatsby-cli -g , it does not work : when I run gatsby --help, it shows:
bash:gatsby command not found
I have tried:
uninstalling and reinstalling NPM
this gitHub solution : https://github.com/gatsbyjs/gatsby/issues/4967
I get a permission error when trying to change npm config set prefix /usr/local
I'm working on mac (version 10.14.5).
My environment details are as follows:
npm -v : 6.9.0
node -v : v10.16.0
What can I do to make it work?
Thanks in advance,
If it's a permissions error, you could use sudo npm install gatsby-cli -g to run it as a superuser. I have to do this when I install something globally.

npm install -g -D not updating dev dependencies in package.json

I've tried opening and closing the open package.json editor, and restarting VS Code, and running and re-running the npm install command at least 8 times but to no avail.
For some reason, the command below does not update my dev dependencies in my package.json file.
$ npm install -g -D webpack
I know I can manually add the dependency but just saying and this is driving me nuts.
Your are passing the option -g which makes npm install the package globally so you can execute the binary directly, remove that flag to install the package locally.
Can you try: $ npm install --save-dev webpack
This is the recommended way to install webpack from npmjs

Why I can't get NPM upgraded?

Here is how I install NPM on a Linux Mint 19.
sudo apt install nodejs
sudo apt install npm
The NPM version I get is 3.5.2, which is not the current version. To upgrade, I try the following commands.
sudo npm install latest-version
which has a few warning messages such as "not such file or directory, open '/home/me/package.json'"
and
sudo mpn install npm#latest -g
which runs without any warning or error messages.
The command
npm -v
still yields 3.5.2.
What is missing?
Also, the reason of using sudo in those upgrade commands is to work around some access permission.
try running:
which npm
and
sudo which npm
I suspect by running sudo apt-get ... you installed npm for your root user as opposed to your current user.
Try this command: npm install -g npm#latest or npm install -g npm#next
You can update NPM with: npm install -g npm.
See this Q&A for more variations that might occur/needed.

Unable to link react-native-version-number

I am trying to install react-native-version-number. The instructions state that after installing, issue;
react-native link react-native-version-number
but when I do this, I get the following error message;
Looks like you installed react-native globally, maybe you meant react-native-cli?
To fix the issue, run:
npm uninstall -g react-native
npm install -g react-native-cli
but when I run
npm uninstall -g react-native
I get
npm WARN uninstall not installed in /usr/local/lib/node_modules: "react-native"
How do I link react-native-version-number?
As a workaround, dv3's comment about using rnpm link did work. However, I found that I was having this problem with other react-native commands, such as react-native run-android. This appears to be because npm was installed using homebrew. A description of this problem and how to fix it can be found at on this gist. In summary the required fix is to uninstall all your npm globably installed packages, uninstall node, then reinstall node, and reinstall npm without brew.
npm list -g --depth=0 # to list all your globally installed packages
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
and then, you have to reinstall all your npm packages that were installed globally.