Global install of typescript doesn't appear to install correctly on windows.
Steps to reproduce:
.Using node v16.16.0 (64bit)
.Then 'npm install -g typescript'
.I can confirm environment path variables contain:
'C:\Users{MyUserName}\AppData\Roaming\npm' and
'C:\Program Files\nodejs\node_modules'
The node_modules/typescript/bin folder appears a follows:
As seen, a tsc file does exist, however the expected tsc.cmd doesn't.
This is required for windows to execute.
My assumption is this must be system or permissions problem whereby node can't create the tsc.cmd, not necessarily and issue with the
typescript package
Image for reference:
//----------------
Additional notes:
I have also tested this on 10.24.1 using nvm, this is now uninstalled
I have ran these steps on another machine, without problems countless
times.
I have uninstalled (completely) nvm and node before attempting this
multiple times.
I have performed a complete system search for tsc.cmd I do have
wsl installed, perhaps there is some interference there?
Results from suggestions this far:
Running locally on a project (Niceman)
I think this is an issue more related to your node path in your environment variables. To test this, install something else globally, like sass for example.
Then you can try sass --version. If it doesn't work the it's probably that your node path is messed up. You can try uninstalling node and reinstall it with the last LTS installing file from the official site. Then you can try to installing typescript again. If that doesn't work you'll need to open the environment variables and check your path for node modules.
Another possible solution is to try using another command line, because maybe a Powershell config is messing up this things. You can try installing git bash. It's not the best, but works.
Solution: use yarn!
As mentioned, I am missing tsc.cmd whatever method I choose (win 11). Who knows what the cause is.
By using yarn :
Delete the dudd folder under your node_modules folder from any npm attempts
yarn global remove typescript
yarn global add typescript
add 'C:\Users{yourUserName}\AppData\Local\Yarn\Data\global\node_modules.bin' to your path
As mentiond, you now have the required tsc.cmd:
What a ride ey!
I'm completely new to using Node and am honestly very confused about how this all works. I have installed node and NPM but every time I try to check the version to see if it's installed, it tells me "command not found". I've been at this for almost 2 hours just deleting all the npm/node files and reinstalling but nothing seems to give. Can someone please explain if there is anything I can do to fix this issue?
-bash: npm: command not found
If I go inside the NPM file through the terminal, it shows me this when I try to run npm install or npm start.
> npm start
npm should be run outside of the Node.js REPL, in your normal shell.
(Press Ctrl+D to exit.)
Add npm to your path (environment variable on windows not sur on linux) if you are using a portable version, if you are using an installed version of node, it should add npm to your path automatically on windows, not sure on linux, npm start will run the start script from your project package.json file. try going into your npm executable folder (generally in node installation folder), n do a ./npm i -g npm
I am installing nodeJS v10 in Windows 10 Pro, After downloading the installer and install, I can run npm and npx to install the node modules but the installed global command cannot be found. I also try to use back npm install -g, but the error stays the same. Saying react-create-app, I can see it is being installed in the specified directory, but it always report command not found.
Command not found
npm config get prefix
Actual directory
Environment variable settings
User Variables
System Variables
As the environment variable seems setting up correctly, it is so weird for not finding the command. Any help would be appreciated, thank you very much
I recently installed node using nvm and had no problems initially with installing globally packages with npm. But then I found that if I close the terminal in which I originally installed the package, I will get "command not found" when attempting to use it.
For example, browser-sync. I closed the terminal after finding that it worked properly. When I opened it up later to continue working on the project I need it for, it turns out that now I get "command not found" in every directory despite installing it globally.
I am running Linux Mint Cinammon 17.3 with the latest version of node and npm.
Any help for this?
I've since solved this problem by:
Completely uninstalling nvm and node.
Reinstalling node using apt-get
Changing npm config prefix to /usr/local
Correctly setting npm permissions
For some reason despite multiple uninstalls/reinstalls and playing with permissions before, it wouldn't work until I deleted all the folders created by node or npm before reinstallment. Weird.
I have a Linux server that runs some virtual Machines using KVM. Host machine is a Debian derivate with kernel 2.6.32-32(-pve).
In roughly 75% of the times I run npm install, it hangs while installing modules. I ran it in silly debug level and it always hangs at the line
npm info postinstall [module name] (older npm versions)
or
npm verb unlock done using [...] (newer npm versions)
forever.
It happens in every project on the host machine and on the virtualized systems for every node and every npm version I have tested (a lot, including the newest ones (2.7.x atm)).
It also is not deterministic. Sometimes it works, sometimes not and most of the times it hangs on a different module.
On my dev machine (which is in the same network, running OS X 10.10) it works fine.
I am not behind any kind of proxy.
What could possibly be wrong here?
EDIT: For the time being I solved this problem by checking in all my dependencies as gzipped files using https://github.com/JamieMason/shrinkpack
I was having the same issue for several hours, and couldn't work out what the problem was. I tried re-installing everything a few times, manually installing individual modules, switching from x64 to x86 versions of NodeJS, etc, and got nowhere.
In the end, I changed networks, from WiFi over ADSL2+ [~2mbps] to 4G Hotspot [~20mbps] and it worked in 30 seconds. No idea why, since it didn't seem like a network speed issue, but it solved the problem.
Hope this helps someone else, too!
I had the same problem on our Jenkins slaves based on Ubuntu, and it was solved by upgrading npm.
Default npm installed by apt-get has version 1.3.10 now, which is very old (shown by npm --version). There are at least two ways to upgrade it:
Run sudo npm install -g npm command. If you want to install a specific version you can run append it at the end of command: sudo npm install -g npm#2.1.3.
Or you could add NodeSource repositories using these instructions and run usual sudo apt-get update.
I have the same problem on Windows. I deleted my npm-cache folder and reinstalled npm. Everything started working normally after that.
The npm-cache folder can be found at
<your-drive>\Users\<your-name>\AppData\Roaming\npm-cache
Remember to turn on 'View hidden files because the AppData folder by default is hidden
You can reinstall npm by using the command,
npm i npm -g
On Windows make sure you are in a native CMD (not in VSCODE or whatever IDE). Also, try increasing the max memory limit for node:
set NODE_OPTIONS=--max_old_space_size=8096
I did the same, switched my network from WiFi to 3G and it worked.
I'm experiencing the same problem, this is the issue on Github:
https://github.com/npm/npm/issues/7862
There are some useful tips that seemed to help a few people.
For me doing $ npm install -g node-gyp (as suggested here: http://gangmax.me/blog/2013/05/13/resolve-npm-update-node-gyp-hung-problem/) fixed the problem.
I had the same problem and just run
npm cache clean
And it works!
Had this same problem in Windows. The solution was to restart after installing node and npm and then run command prompt as administrator.
In my case, a system restart did the work.
I ran npm install --verbose which suggested some lock on a file in npm-cache. And I think the system released the file (which was under use) after the system restart. I am using windows.
Try cloning the project again and then run npm install to install the packages in your terminal.
I ran into this with npm v6, and it turned out I was just being impatient. I just needed to wait a little longer and it proceeded to the next step.
npm cache clean --force
works for me :)
=> this method working with me When npm block in installation Package for IONIC installation and ReactNative and another package npm.
you can change temporary :
npm config set prefix C:\Users[username]\AppData\Roaming\npm\node_modules2
change the Path in Environment Variables set C:\Users[username]\AppData\Roaming\npm\node_modules2
Run the your command to install your package .
open file explorer copy the link C:\Users[username]\AppData\Roaming\npm\node_modules
ok file yourpackage.CMD created another folder Created "node_modules2" in node_modules and contain your package folder.
copy your package file CMD to parent folder "npm"
copy your package folder to parent folder "node_modules"
now run npm config set prefix C:\Users[username]\AppData\Roaming\npm
change the Path in Environment Variables set C:\Users[username]\AppData\Roaming\npm
now package working correctly with Command line