Can't run npm after installing - npm

I've seen many similar posts on this here on SO but for some reason those solutions don't seem to work for me. Clearly I'm missing something.
I installed depcheck package globally by running npm install -g depcheck which ran fine without any errors.
If I go into the global directory for npm packages which is:
c:\Users\<Username>\AppData\Roaming\npm on my Windows 10 machine, I do see the depcheck.cmd file.
I also see the depcheck folder within c:\Users\<Username>\AppData\Roaming\npm\npm_modules folder.
I think this means I was able to install the depcheck package globally.
When I run npm config get prefix, I get c:\Users\<Username>\AppData\Roaming\npm which seems to be the correct path.
Why is it that when I run depcheck inside my project's root folder where the package.json is located, I get:
'depcheck' is not recognized as an internal or external command,
operable program or batch file
If I try another standard npm command inside my project's root folder, it works fine. For example, I ran npm -v and got the version number.
What am I doing wrong?

I also had this problem before. After searching on the web I found that reinstalling NPM with Administrator permissions worked for me, as the installer without Administrator permissions doesn't create/write to some specific files. I hope this will help for you.
Pascal.

Related

The imported project "C:\Microsoft.Cpp.Default.props" was not found

When trying to npm install node-sass on a new virtual machine I'm getting this error:
The imported project "C:\Microsoft.Cpp.Default.props" was not found.
I've tried multiple solutions as follows:
Installing the VS Build Tools
installing either LTS, or Current Node.js version.
Adding/Setting the VCTargetsPath variable in the registry.
Looking for the MSBuild folder (which I don't seem to have)
Yet nothing's worked.
The odd thing is that my old computer can install and run node-sass just fine without having that variable or folder either, so I'm not sure what exactly is the cause of this.
I am not a cpp user first of all. But I have got some links that might help.
npm install -g karma error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found
Secondly, you can try looking for the MSBuild folder in this location, as it was in mine.
Location: C:\ProgramFiles(x86)\MSBuild\Microsoft.Cpp\v4.0\V120.
Hope it helps :D

does "npm pack" memorize version of package?

I'm newbie at development, first, I'm not good at English. I hope your understanding.
TLDR;
I'm making UI library now. for the test of it, I found npm pack command.
It seems like If I enter npm pack once in specific version, then I cannot change the library contents without upgrading version in package.json file.
I wanna modify contents of library and test of it without version upgrade before publish.
is this possible?
ex) my situation
library v0.0.8, I found some problems.
modified contents of library without upgrading version(to v0.0.9)
npm pack
install library at test folder
changes were not reflected in test folder.
package.json -image
I'm making an npm UI library for company.
I was thinking about how to do the test of it, and found "npm pack" command.
I made the pacakage version v0.0.8, and entered the "npm pack" command.
after copy of tgz file, I pasted it to root directory of test folder.
and I downloaded it with yarn add ./library-test-0.0.8 at test folder.
after that, I found some problems of library, so modified those at package files.
but I didn't modified version of pacakage as v0.0.9 in package.json file.
after delete all builded files at dist directory, I entered npm build, npm pack
and I deleted v0.0.8 from my test folder with yarn remove library-test
again, after copy of new tgz file, I pasted it to root directory of test folder.
However, the changes I made were not properly reflected at test folder.
I tried npm cache clean --force, but it didn't work.
also, I tried it in new test folder, but it was same.
folder structure -image at ui-library
folder structure -image at test folder
as you can see above images, types folder should be deleted.
I guess, if I enter 'npm pack' command once, npm memorize that version and does not change.
is there any way to reset this npm's behavior?
I tried modifying version in pacakage.json(by upgrading v0.0.9) at my pacakge, it worked.
but this method will confuse me in the future..
I searched like below.
how to reset npm pack version
npm pack memorize version
npm pack revert
but I couldn't find what I want.
is there anyone who can give me some keywords or sites for this problem?

Electron Atom - Module "Node-Windows" not found after compiling

After hours of searching and still not finding a usefull answer, I hope somebody could help me with following issue that I'm facing:
I inclued to my Electron APP a module called "node-windows" so I could register a script as a service to a windows machine.
I've installed it over the command
=> npm install -g node-windows
and linked it to my project path with:
=> npm link node-windows
However if I try to compile my Project with EPI with or without asar source packaging, and start up the compiled EXE, I'm getting following error from the DeveloperTools:
Uncaught Error: Cannot find module 'node-windows'
As long the project isn't compiled yet, everything works fine.
I already checked that the module is linked to the folder node_modules in the APP Directory as also in the npm folder in the AppData directory.
What could I've been missing or what could I check to get this working?
Thank you already very much for an answer
Ok here my Solution. Guess this was an absolutely noobie mistake ^^
I've forgot to include the module to the package.json file.
I did this with "npm install -g node-windows --save-dev" & "npm install -g node-windows --save".
After that it worked.

bower install command issuing EHTTP error

I am struggling with installing bower on my system - although there are a few bower install issue scenarios on here, none are a very good match.
In my scenario, I have an externally acquired folder full of source code for a complex software package - the .bowerrc file is located here, as well as a bower.json. As is the default, my .npmrc file is located C:\Users\USER.
I have appended code strict-ssl=false and registry=http://registry.npmjs.org/ into .npmjs, and left the npm cache and config specs in the user directory. I've also left my PATH user variable as C:\Users\USER\AppData\Roaming\npm.
I have so far run three commands successfully:
npm install -g ember-cli
npm install -g bower
npm install
The created files from these commands seem to get dumped into C:\Users\USER\AppData\Roaming\npm\node_modules, and then the final command below is only giving me an EHTTP error.
bower install
I can only think that this issue is only occurring because of the location of the various dependencies. I've been playing around a bit - the last thing I tried was changing the Path user variable so that it instead points to the folder directory with .bowerrc, but the npm installation then has trouble referencing .npmrc. I'd appreciate any ideas, because I might only be chasing my own tail here.
UPDATE
I think I was wasting my time messing about with directory locations. The problem seems to be that there is a legacy proxy inside the .bowerrc file.. now I just need to work out how to get rid of the proxy setting!

Yo unaware of installed generators

I just installed Yeoman and some generators. However, because the /usr/lib folder is protected, I chose to change the prefix of the location where NPM installs its packages.
Right now, everything is getting installed under ~/.node. I also changed my $PATH and added ~/.node/bin. However, when I execute yo <name of generator>, I get the following:
Error node
You don't seem to have a generator with the name node installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 0 registered generators run yo with the `--help` option.
As you can read here, it's telling me there are 0 registered generators, but I installed them correctly (and it completed without errors). I'm able to find the installed generators, for example ~/.node/lib/node_modules/generator-node exists and when I execute the following command:
npm list -g
I can find the generators that I installed (so I assume it isn't a problem with npm).
So I think Yeoman (or Yo to be more precisely) is unaware of the generators being installed in the custom folder, but I haven't found any way to configure this.
In addition to adding it to your path, you should also set a NODE_PATH environment variable. The yeoman/generator code will look there first:
// We tried using NPM to get the global modules path, but it haven't work out
// because of bugs in the parseable implementation of `ls` command and mostly
// performance issues. So, we go with our best bet for now.
if (process.env.NODE_PATH) {
_.compact(process.env.NODE_PATH.split(/[;:]/g)).forEach(this.appendPath, this);
return;
}
Looks like a NODE_PATH issue, try to execute the following command:
echo "export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules" >> ~/.bashrc && source ~/.bashrc^C
Or just type yo doctor to figure out what's happening