adding npm packages to windows - windows

I have installed node and npm onto my computer without a problem (I am running windows 8) however this is my first time using windows and I cant seem to access any packages I install without getting an error message Could not find files for the given I should also mention im working in visual studios on a .net and angular project, the node is just for testing.
where node gives me C:\Program Files\nodejs\node.exe
where npm gives me C:\Program Files\nodejs\npm.cmd
but I know the karma package I installed went to C:\Users\Admin\AppData\Roaming\npm\node_modules I have added a NODE_PATH to my environment variables but it didnt help. Any thoughts?
this is a snippet from command prompt:
C:\Users\Admin\AppData\Roaming\npm\node_modules>dir
Volume in drive C is 000000
Volume Serial Number is 000000
Directory of C:\Users\Admin\AppData\Roaming\npm\node_modules
2015-01-05 06:39 PM <DIR> .
2015-01-05 06:39 PM <DIR> ..
2015-01-05 06:39 PM <DIR> karma
2015-01-05 06:39 PM <DIR> karma-cli
0 File(s) 0 bytes
4 Dir(s) 918,342,209,536 bytes free
C:\Users\Admin\AppData\Roaming\npm\node_modules>where karma
INFO: Could not find files for the given pattern(s).
C:\Users\Admin\AppData\Roaming\npm\node_modules>

Are you trying to use the command-line command karma or require() the package in a module? You need to install packages differently for these use cases.
> npm install -g karma
Will install the karma package globally, and it should then be accessible from your command line. You may need to close and re-open your command prompt or re-set the PATH environment var.
If you want to use the package with require, you will need to create a package directory, run npm init, and then install karma locally with npm install --save karma. This will install the package under the node_modules directory for that package only. npm does this to avoid conflicts between different packages which may require different versions of the same package.
Please forgive me if I am misunderstanding your question.

Related

How to produce the Electron Packaged App for Windows in Ubuntu Environment using Electron-Forge?

I'm developing in Ubuntu 22.04 Desktop environment. To produce a packaged app for Windows do I need to use a MS Windows environment or can I do it within Ubuntu 22.04 Desktop environment? I ask this, because I do not see any "windows"-related output:
/out/make$ ls -lah
total 20K
drwxrwxr-x 5 raphy raphy 4,0K gen 5 12:42 .
drwxrwxr-x 4 raphy raphy 4,0K gen 5 12:41 ..
drwxrwxr-x 3 raphy raphy 4,0K gen 5 12:41 deb
drwxrwxr-x 3 raphy raphy 4,0K gen 5 12:42 rpm
drwxrwxr-x 3 raphy raphy 4,0K gen 5 12:42 zip
even if I've set in package.json maker-squirrel :
"makers": [
{
"name": "#electron-forge/maker-squirrel",
Do I have to install the wine terminal in my Ubuntu 22.04 Desktop environment, in order to correctly product the Windows packaged app? Or what else do I have to do?
Executing : yarn make --platform=win32 I get the following message:
raphy#raohy:~/ForgeTypescriptReactWebpack$ yarn make --platform=win32
yarn run v1.22.19
$ electron-forge make --platform=win32
✔ Checking your system
✔ Loading configuration
✔ Resolving make targets
› Making for the following targets: squirrel, zip
❯ Running package command
✔ Preparing to package application
✔ Running packaging hooks
✔ Running generateAssets hook
✔ Running prePackage hook
✔ [plugin-webpack] Preparing native dependencies: 1 / 1
✔ [plugin-webpack] Building webpack bundles
❯ Packaging application
❯ Packaging for x64 on win32
✔ Copying files
✔ Preparing native dependencies [0.1s]
✖ Finalizing package
› Wrapper command 'wine64' not found on the system. Consult your Linux distribution's package manager to deter…
Wine is required to use the appCopyright, appVersion, buildVersion, icon, and
win32metadata parameters for Windows targets.
See https://github.com/electron/electron-packager#building-windows-apps-from-non-windows-platforms for detai…
◼ Running postPackage hook
◼ Running preMake hook
◼ Making distributables
◼ Running postMake hook
An unhandled rejection has occurred inside Forge:
Error: Wrapper command 'wine64' not found on the system. Consult your Linux distribution's package manager to determine how to install Wine.
Wine is required to use the appCopyright, appVersion, buildVersion, icon, and
win32metadata parameters for Windows targets.
See https://github.com/electron/electron-packager#building-windows-apps-from-non-windows-platforms for details.
at spawnWrapper (/home/raphy/ForgeTypescriptReactWebpack/node_modules/cross-spawn-windows-exe/dist/src/wrapper.js:77:19)
at async module.exports (/home/raphy/ForgeTypescriptReactWebpack/node_modules/rcedit/lib/rcedit.js:42:3)
at async WindowsApp.runRcedit (/home/raphy/ForgeTypescriptReactWebpack/node_modules/electron-packager/src/win32.js:95:7)
at async WindowsApp.create (/home/raphy/ForgeTypescriptReactWebpack/node_modules/electron-packager/src/win32.js:105:5)
at async Promise.all (index 0)
at async packager (/home/raphy/ForgeTypescriptReactWebpack/node_modules/electron-packager/src/index.js:204:20)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
So, definitely Wine has to be installed
After installing wine and executing the yarn make --platform=win32 again, I get some strange errors, for which I open another post

Can't properly install hardhat using Powershell! Persistent Error HH12: Trying to use a non-local installation of Hardhat, which is not supported

Below is a short list of my setup until I stumble upon the HH12 Hardhat Error that I keep getting:
mkdir wave (Name of my directory)
cd wave
npm init -y
npm install —save-dev hardhat
npx hardhat
Choose sample project
6a. Hardhat project root (Select)
6b. Add .gitignore
Say yes to everything
install the remaining dependencies: npm install --save-dev #nomiclabs/hardhat-waffle ethereum-waffle chai #nomiclabs/hardhat-ethers ethers
npx hardhat accounts (to see all the different accounts)...
...And then it fails here! An HH12 Hardhat Error Message: "Hardhat is not installed or installed globally. You tried to run Hardhat from a global installation or not installing it at all. This is not supported. Please install Hardhat locally using npm or Yarn, and try again." (https://hardhat.org/errors/) [BTW, these 2 lines are the ONLY docs on this error on Hardhat!].
Any suggestions?
I have tried the following possible 'fixes' to sidestep this error but to no avail:
Updating most current version of node
Restarting my PC (About 17 X now as of this writing)
Using GitBash (Instead of Powershell)
Asking mods in Hardhat Discord (None) and other Discords
Opening the Hardhat docs (And the Tutorials!!) for answers... None!
StackExchange - There's literally only 1 other person who ALSO had this problem here! But the answers here are not the solution. (Have DMd that person but no reply as of yet).
So can anyone out there help?
I believe I finally figured out the solution (at least what worked for me):
I dropped back 2 directory levels from where I was for my root project and started again there.
I updated my Node version to 16.

Titanium: ERROR | An uncaught exception was thrown! spawn C:\nodejs\node.exe

I am trying to run my sample program in appcelerator studio.
i have installed android SDK and node js .
C:\Program Files (x86)\nodejs\node.exe C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\alloy\bin\alloy compile F:\Appcelerator\simpleAlloy\app --config platform=android,version=0,simtype=none,devicefamily=none,deploytype=development,target=emulator --no-colors
2016-03-07T07:18:33.959Z | ERROR | An uncaught exception was thrown!
spawn C:\nodejs\node.exe
2016-03-07T07:18:33.959Z | ERROR | spawn C:\nodejs\node.exe
C:\Program Files (x86)\nodejs\node.exe ENOENT
2016-03-07T07:18:33.960Z | TRACE | Error: spawn C:\nodejs\node.exe
C:\Program Files (x86)\nodejs\node.exe ENOENT
at exports._errnoException (util.js:870:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:441:9)
at process._tickCallback (node.js:355:17)
---------------------------------------------
at ChildProcess.spawn (internal/child_process.js:281:13)
at exports.spawn (child_process.js:362:9)
at F:\Appcelerator\simpleAlloy\plugins\ti.alloy\hooks\alloy.js:161:14
at C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\node-appc\lib\async.js:46:6
at C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:697:13
at C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:52:16
at done (C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:248:21)
at C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:44:16
at C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:694:17
---------------------------------------------
at Object.exports.execFile (child_process.js:296:9)
at exports.exec (child_process.js:111:18)
at F:\Appcelerator\simpleAlloy\plugins\ti.alloy\hooks\alloy.js:99:7
at C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:689:13
at C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:239:13
at _arrayEach (C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:91:13)
at _each (C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:82:13)
at async.forEachOf.async.eachOf (C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:238:9)
at _parallel (C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\titanium\node_modules\async\lib\async.js:688:9)
C:\Program Files (x86)\nodejs\node.exe ENOENT
But i have node installed in SDK as well seperately in my system.
Read this below url first,
http://docs.appcelerator.com/titanium/3.0/#!/guide/Software_Locations_and_Environment_Variables-section-29004844_SoftwareLocationsandEnvironmentVariables-WindowsSoftwareLocations
–> This url contains environment variables setup for titanium applications.
–> Check all environment variables (ex: path) correctly set or not.
–> After setting all environment variables correctly, Restart the studio and rebuild.
Thanks.
I resolved the issue for me by removing one of the versions of nodejs. I had two versions installed. Win 8.1. By the way, I managed to run the command
C:\Program Files (x86)\nodejs\node.exe C:\Users\apanditi\.appcelerator\install\5.2.0\package\node_modules\alloy\bin\alloy compile F:\Appcelerator\simpleAlloy\app --config platform=android,version=0,simtype=none,devicefamily=none,deploytype=development,target=emulator --no-colors
successfully in a separate cmd window during occuring this error in appcelerator studio
You don't need to uninstall one of the versions, actually you just have to look at the PC environment variables and just remove node from path! It might look strange but it indeed solved the spawn ENOENT problem. It happened to me when I installed Platino Studio 1.1 which uses older Node.js version.
so you can keep both versions installed the 4.0 and the 0.12.7 but just remove their path instance from pc environment variables.
my pc os is windows 10

Node.js failed to install global npm packages on windows (not path)

So, I have a strange problem that I'm not even sure I can identify. I just installed the current version of Node.js (v.10.*) on my Windows 7 machine. I have tried to install a couple packages globally (gulp and yoeman), but I get errors when they are installing and in my C:\Users\Michael\AppData\Roaming\npm\node_modules directory, many of the package files are missing. Obviously, when I try to run the command globally, it fails because there IS NO command. It was never created.
Some other globally installed packages work fine (bower and grunt).
To make things really tricky. When I install gulp to a local folder (without the -g), the install works perfectly and I can use gulp by prepending the entire path before the command. Obviously, I could add that path to my system properties so the command would be global, but that wouldn't really fix my problem. Why does the install produce errors when installing globally, but not when installing locally?
As I watch the directory while gulp is installing locally, I see the files being created. Then the first error comes along and many of the files are deleted.
I believe the relevent parts of the log for my gulp install are:
6949 verbose lock lodash.noop#2.4.1 C:\Users\Michael\AppData\Roaming\npm-cache\7e62c2bb-lodash-noop-2-4-1.lock
6950 error Error: ENOENT, lstat 'C:\Users\Michael\AppData\Roaming\npm\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob2base\node_modules\lodash.findindex\node_modules\lodash.createcallback\node_modules\lodash._baseisequal\node_modules\lodash._releasearray\node_modules\lodash._arraypool'
6951 error If you need help, you may report this *entire* log,
6951 error including the npm and node versions, at:
6951 error <http://github.com/npm/npm/issues>
6952 error System Windows_NT 6.1.7601
6953 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "gulp"
6954 error cwd c:\wamp\www\phoenix\animus\gulp
6955 error node -v v0.10.28
6956 error npm -v 1.4.9
6957 error path C:\Users\Michael\AppData\Roaming\npm\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob2base\node_modules\lodash.findindex\node_modules\lodash.createcallback\node_modules\lodash._baseisequal\node_modules\lodash._releasearray\node_modules\lodash._arraypool
6958 error fstream_path C:\Users\Michael\AppData\Roaming\npm\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob2base\node_modules\lodash.findindex\node_modules\lodash.createcallback\node_modules\lodash._baseisequal\node_modules\lodash._releasearray\node_modules\lodash._arraypool
6959 error fstream_unc_path \\?\C:\Users\Michael\AppData\Roaming\npm\node_modules\gulp\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\glob2base\node_modules\lodash.findindex\node_modules\lodash.createcallback\node_modules\lodash._baseisequal\node_modules\lodash._releasearray\node_modules\lodash._arraypool
6960 error fstream_type Directory
6961 error fstream_class DirWriter
6962 error code ENOENT
6963 error errno 34
6964 error fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
6964 error fstream_stack Object.oncomplete (fs.js:107:15)
6965 verbose exit [ 34, true ]
I have log files if that would help.
Thank you.
Windows can only support 260 characters as Max Path Length. I hope nodejs developers will resolve the nesting module approach. To do a workaround I simply change the global npm modules path to c: from AppData to get some characters and it resolves the issue. I know that this hack just provide you few characters but it is working for me.
To do so,
Open notepad in Administrator mode.
Go to location [nodejs installation directory]\node_modules\npm
Open file "npmrc" and change prefix=c:\npm
Save the file.

Can't install PEAR on Windows 7, Structures/Graph error

I just did a clean install of Windows 7. I've installed Apache, Mysql
and PHP 5.3.5 all separated (not using XAMPP/others).
I'm getting the following error in the install: ERROR: unable to unpack phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar
The full stack trace is:
C:\Web\php-5.3.5>go-pear.bat
Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : system
Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations.
1. Installation base ($prefix) : C:\Web\php-5.3.5
2. Temporary directory for processing : C:\Web\php-5.3.5\tmp
3. Temporary directory for downloads : C:\Web\php-5.3.5\tmp
4. Binaries directory : C:\Web\php-5.3.5
5. PHP code directory ($php_dir) : C:\Web\php-5.3.5\pear
6. Documentation directory : C:\Web\php-5.3.5\docs
7. Data directory : C:\Web\php-5.3.5\data
8. User-modifiable configuration files directory : C:\Web\php-5.3.5\cfg
9. Public Web Files directory : C:\Web\php-5.3.5\www
10. Tests directory : C:\Web\php-5.3.5\tests
11. Name of configuration file : C:\Web\php-5.3.5\pear.ini
12. Path to CLI php.exe : C:\Web\php-5.3.5
1-12, 'all' or Enter to continue:
Beginning install...
Configuration written to C:\Web\php-5.3.5\pear.ini...
Initialized registry...
Preparing to install...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.3.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.3.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.8.0.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2.1.tar...
install ok: channel://pear.php.net/Archive_Tar-1.3.3
install ok: channel://pear.php.net/Console_Getopt-1.2.3
ERROR: unable to unpack phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar
install ok: channel://pear.php.net/XML_Util-1.2.1
install ok: channel://pear.php.net/PEAR-1.8.0
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's' PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
** WARNING! Old version found at C:\Web\php-5.3.5, please remove it or be sure t
o use the new c:\web\php-5.3.5\pear.bat command
The 'pear' command is now at your service at c:\web\php-5.3.5\pear.bat
* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under C:\Web\php-5.3.5\PEAR_ENV.reg .
This file creates ENV variables for the current user.
Double-click this file to add it to the current user registry.
C:\Web\php-5.3.5>
After days of googling I've found an answer. Here is it. How to solve:
With admin permission (start cmd with admin privileges):
Run the go-pear.bat that comes with the default PHP installation. It'll installs PEAR, but it's going to generate an error when installing Structures_Graph. IMO Pear needs this package to generate the package dependency (graph), since it's missing it not allow us to install or upgrade any other package.
Download and uncompress Structures_Graph from the pear.php.net website (direct link). Then copy the Structure folder into the PEAR folder. The archive has three folders: docs, Structures, tests. We only need the Structures one. Copy the Structures folder to your PHP_ROOT_DIRECTORY\PEAR directory. So if you installed PHP on C:\Web\php-5.3.5 copy the Structures folder to C:\Web\php-5.3.5\PEAR\, the result should be: C:\Web\php-5.3.5\PEAR\Structures
Do pear install Structures_Graph. Even though the files are present, Structures_Graph is not really installed (we had a problem during installation). So we need to run the command above.
Do pear upgrade PEAR. This upgrades PEAR itself to the current version.
Do pear upgrade Console_Getopt. This upgrades Console_Getopt to the current version and now we can manage and install any pear package.
Marcos Roriz solution does indeed work, but to clarify point 2:
The uncompressed "Structures" folder (inside the tgz) needs to be placed inside the folder: "PEAR\pear" -> e.g. C:\wamp\bin\php\php5.3.5\PEAR\pear
This is a combination of the things you need to do and a couple of new tweaks. Worked on WinXP Pro with WAMP (Wampserver 2.2.1)
Change your go-pear.bat file:
#ECHO OFF
set PHP_BIN=php.exe
%PHP_BIN% -d output_buffering=0 -d phar.require_hash=0 PEAR\go-pear.phar
pause
Run it - go-pear.bat
Now you've go a Pear install with a missing graph.php
Download and uncompress Structures_Graph from the pear.php.net website. Copy the Structure folder into the PEAR folder so that the key files are located as such:
PEAR\Structures\Graph.php
PEAR\Structures\Graph\Node.php
Change this line in Node.php:
require_once '/Structures/Graph.php';
Execute in the PEAR directory:
pear upgrade=all
That did it for me.
First of all, run as administrator.
Then - try to write something in target directory in the console to isolate any remaining permissions problems.
I've been having many issues after upgrading my wampserver which now comes with php 5.3.5.
I have solved the problem by installing php 5.3.0 alongside and using it to run the installer found at http://pear.php.net/go-pear. I set the php cli setting to the php5.3.5 folder without any issues.
This might be wampserver specific. To gauge if you are experiencing a similar problem here are some of the issues I encountered:
Using the go-pear.bat packaged with php5.3.5 i had the same unable to unpack error as the original poster.
Using the go-pear.bat packaged with php5.3.0 i was able to complete the installation but the pear installer was v1.8.0
Using the installer on the pear site mentioned previously with php5.3.5 i had an error "Warning: rmdir(D:\temp): Directory not empty in D:\go-pear.php on line 1237". Looking at the stack trace the Archive_Tar class was throwing an error and the installer was failing to clean up after itself.
the web frontend not write correct paths to pear.ini
ig phph setting is magic_quotes_gpc = On
its doubles all slashes "\" in paths to "\" is it a bug ?
Than the packages for example can be unpacked (wrong paths ?)
"unable to unpack" Message when installing packages
http://pear.php.net/bugs/bug.php?id=18212
I tried all of the above with no luck. After downloading and extracting the "Structures" folder I had to edit all paths and add "PEAR/". Then I was able to do "pear install Structures_Graph" and then "pear upgrade-all"
Graph.php
require_once 'PEAR/Structures/Graph/Node.php';
Node.php
require_once 'PEAR/Structures/Graph.php';
AcyclicTest.php
require_once 'PEAR/Structures/Graph.php';
require_once 'PEAR/Structures/Graph/Node.php';
TopologicalSorter.php
require_once 'PEAR/Structures/Graph.php';
require_once 'PEAR/Structures/Graph/Node.php';
require_once 'PEAR/Structures/Graph/Manipulator/AcyclicTest.php';

Resources