Cannot find module 'jasmine-reporters' - node.js

My 'npm' folder is in D:\Box folder because I don't have space on C.
I configure Protractor to work by adding in System Environment Variables new environment variable named PROTRACTOR with value: .
Then in System Path I've entered: %PROTRACTOR%\bin
And this works for Protractor perfectly.
Now I want to add jasmine-reporters and I paste in npm\node_modules\jasmine-node\node_modules 'jasmine-reporters' and 'jasmine-growl-reporter' folders.
Then run one test with jasmine report in conf.js and I see error message:
Cannot find module 'jasmine-reporters'.
What I try:
Paste 'jasmine-reporters' and 'jasmine-growl-reporter' folders in npm\node_modules
Add in System Environment Variables NODE_PATH: D:\Box\npm\node_modules
The result is the same.
Someone, please help me with this issue.

If you want to keep your global node_modules on the D:\ drive you need to change prefix in npm config as described in npm docs
Short version (in command prompt as administrator):
npm config set prefix d:\box
To see what is the current path you can issue:
npm config get prefix

Go to C:\Users\username\AppData\Roaming\npm\node_modules
-Remove jasmine-reporters
Go to C:\Users\username\AppData\Roaming
-Remove npm-Cache
Reinstall jasmine-reporter and npm

Related

How do I fix my npm that seems to be infinitely looping?

I was trying to change my npm and npm-cache folders to d:\\npm-global and d:\\npm-cache
I managed to do a npm config set cache d:\npm-cache
When I tried to do a npm config set prefix d:\npm-global I accidentally put a ' in the folder string as I was hitting enter. I deleted the errant folder after trying a npm i -g gulp and to my horror, npm stopped working altogether, it just sits there with my command prompt rocking up to 50% CPU usage.
Help please! I've tried searching the registry and other places, even uninstalled and re-installed the nodejs msi package on Windows. This reset the D:\Program Files\nodejs\node_modules\npm\npmrc file.
Still no luck. I can't get npm to work again. :(
edit A little digging in and I realized there is a second node server running via Adobe Creative Cloud. I doubt this is the problem though as when I run npm from the cmd.exe prompt, the correct (d:\program files\nodejs) version of the npm server is executed for that process.
edit so only sometimes when I hit Control-C, I'll get this error:
seems like it's trying to find a file that doesn't exist. However, I cleared out the AppData\Roaming\npm folder and the reinstalls reset the default d:\program files\nodejs\....npm\npmrc file. I also made sure that the environment variable NODE_PATH is not set. It wasn't set when it was working. I set it when I was trying to make my changes.
You should be able to modify your config settings manually by modifying ~/.npmrc
#jakemingolla was right so I marked that answer as accepted (thanks Jake), but I also asked this in the NPM forum and did a little test after I got it working. I thought this might help someone: https://npm.community/t/i-killed-my-npm-on-windows-trying-to-move-some-folders-reinstalling-nodejs-isnt-resetting-the-problem/5743/8?u=chi11ax

How to include the path for the node binary npm was executed with

Windows, VSC, Running npm start got this
npm WARN lifecycle The node binary used for scripts is C:\Program
Files\nodejs\node.exe but npm is using
C:\somewhere\AppData\Roaming\npm\node_modules\node\bin\node.exe
itself. Use the --scripts-prepend-node-path option to include the
path for the node binary npm was executed with.
I understand it means my local version is diff from the one in the PATH variable (C:\Program Files...). How do proceed to tell it to use --scripts-prepend-node-path?
I played a trick by replacing the C:\Program Files\nodejs with C:\somewhere\AppData\Roaming\npm\node_modules\node\bin in PATH variable, it does pick up that new node.exe got but there is no node binary in the current PATH. Again recommend to use the --scrip
ts-prepend-node-path option to include the path for the node binary npm was executed with
Like I said, replacing the actual path in PATH system variable didn't fix the problem completely, it still complained about binary is missing. Found this solved the there is no node binary in the current PATH problem. So I restored the original PATH, then:
Simply create a file at the root folder of the app, called .npmrc,
place this line into it:
scripts-prepend-node-path=true
Here's another way that works: npm config set scripts-prepend-node-path auto
Conflict between your node binary and your npm
In case the error looks something like:
npm is trying to use the same node as the one it use to run itself.
resolve this conflict by adding the node directory to your PATH:
npm config set scripts-prepend-node-path true
From the npm documentation:
npm run sets the NODE environment variable to the node executable with
which npm is executed. Also, if the --scripts-prepend-node-path is
passed, the directory within which node resides is added to the PATH
Having this issue in Visual Studio 2017, I instead told VS to always use the NodeJS that I had installed from nodejs.org rather than the frozen-in-time one that ships with Visual Studio. (The one that shipped with VS2015 is so ancient it doesn't really work anymore.)
In Visual Studio, go to TOOLS > OPTIONS > search for EXTERNAL WEB TOOLS > and ensure "C:\Program Files\nodejs" (or wherever nodejs.org installed it) is first in the list of paths, adding it if necessary.
For WebStorm, invalidating caches and restarting worked for me.

npm -v. The system cannot find the path specified

I installed node js on windows 7 from https://nodejs.org/en/download/. When I run node -v out put is v8.9.4 But when I check npm -v out put is
The system cannot find the path specified.
5.6.0
In path variable entry is as
C:\Users\<username>\AppData\Roaming\npm
blank npm folder is present on above path
I added entry in path variable as it is recommended in some answer
C:\Program Files\nodejs
but still getting same error. I tried solutions I found online like above path entry, re installation, global installation of npm but still same error
I found a solution in this article: https://www.thetopsites.net/article/53531888.shtml
"I needed to move my node paths further up the list. Windows must have been looking for NPM in the wrong path variable. I moved my node path to the top of the system path variables and now NPM works."
It helped me after a day of struggle.
More details for the solution provided by #Thomas.K:
Open Windows Settings and search for 'environ' like here:
Make sure to choose the one for "system environment", and in the dialog which appears press this button:
You will get this dialog
There are two PATH declarations, at top and bottom. You will have to remove the npm entry off the upper list, and paste it into the top of the lower list. This should solve the problem of "The system cannot find the path specified".

node 6.11.3 NODE_EXE not found in IntelliJ

I've updated my project to use node 6.11.3. When I now try to start a npm-script by using the Run-configurations provided from IntelliJ, I always receive the following error:
Error: Failed to replace env in config: ${NODE_EXE}
Important: This error appears only if I start npm from within my project. If I use the windows cmd, the error doesn't appear.
What could possibly have changed between node 6.11.2 and 6.11.3? Because with the prior version, everything worked fine.
A workaround for me is to add the NODE_EXE variable to my run configuration, but In my opinion, that shouldn't be needed, because it worked in 6.11.2 too.
Looks as if you have ${NODE_EXE} variable set in one of your npmrc files (see https://docs.npmjs.com/files/npmrc#files), and it can't be properly expanded for some reason when you run your script in the IDE.
is the issue specific to certain project?
how many npm versions do you have installed? Please check that npm chosen in Node.js Interpreters dialog is the same as you use in cmd shell?
please create an env.js file with console.log(process.env) and try running it via npm ("env" : "node env.js") in both cmd console and WebStorm - what is the result?

How to get the npm global path prefix

I believe that in the past I've discovered an option to pass to npm to get it to output the path it is using for -g (global modules). Does anyone know such an option? Or any other method to get the global path prefix npm is using?
I know where where the global modules live on my computer (/usr/local/share/npm/bin), and generally it only takes a few minutes to find global modules on other computers: usually $PATH is correctly configured, and if not, well, poking around does the trick. But isn't there be some quick way to tell how npm was built, and which path it's using for globals modules?
npm config get prefix will return the path.
How about npm bin?
It can be used with export PATH="$(npm bin):$PATH". It will find npm's bin global directory (or if exist: local).

Resources