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

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.

Related

Strapi Graphql Plugin Crashes Strapi Server

I just tried to install the graphql plugin for strapi (i.e., strapi-plugin-graphql). When I tried to install it via the admin interface, I got the following error message:
The restart takes longer than expected
The server should have restarted, please check your logs in the terminal
When I check my terminal, this is what I see:
[2019-12-27T07:47:12.612Z] debug GET /admin/plugins (5 ms) 200
[2019-12-27T07:47:15.882Z] info Installing graphql...
[2019-12-27T07:48:59.105Z] info File changed: C:\code\tutorials\react\Gatsby\strapi\startup-reporter\package.json[2019-12-27T07:48:59.279Z] debug POST /admin/plugins/install (103411 ms) 200
[2019-12-27T07:48:59.281Z] info The server is restarting
[2019-12-27T07:49:14.672Z] debug ⛔️ Server wasn't able to start properly.
[2019-12-27T07:49:14.674Z] error Error: Field "Query.news" can only be defined once.
at assertValidSDL (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql\validation\validate.js:108:11)
at Object.buildASTSchema (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql\utilities\buildASTSchema.js:71:34)
at Object.buildSchemaFromTypeDefinitions (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql-tools\dist\generate\buildSchemaFromTypeDefinitions.js:23:28)
at makeExecutableSchema (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\graphql-tools\dist\makeExecutableSchema.js:26:29)
at Object.generateSchema (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\strapi-plugin-graphql\services\Schema.js:300:22)
at Object.initialize (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\strapi-plugin-graphql\hooks\graphql\index.js:59:50)
at Promise.resolve.then (C:\code\tutorials\react\Gatsby\strapi\startup-reporter\node_modules\strapi\lib\hooks\index.js:37:28)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! startup-reporter#0.1.0 dev: `strapi develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the startup-reporter#0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\moshe\AppData\Roaming\npm-cache\_logs\2019-12-27T07_49_14_697Z-debug.log
Any idea why I am getting this error message and how to fix it?
UPDATE:
I should note that I did a fresh install of strapi and then installed the graphql plugin -- and it installed properly. It only didn't work with an installation that already had custom post types. I don't know why that is -- and what I can do to install it with those custom post types. Any ideas?
Here is the issue about this problem
https://github.com/strapi/strapi/issues/1198
Some words are not well managed for the pluralize version.
So the issue is due to that point.
There is currently nothing to do to fix it by your own.

npm Windows 7 error

I am helping someone get through running npm in Windows 7. When npm update is executed, the following error (ENOENT, scandir) is returned. But the folder that npm could not find has been verified to exist, and the user running npm has full permissions on the folder. Below are the details of the npm-debug.log for this error:
18265 silly fetchPackageMetaData errno: -4058,
18265 silly fetchPackageMetaData code: 'ENOENT',
18265 silly fetchPackageMetaData syscall: 'scandir',
18265 silly fetchPackageMetaData path: 'C:\\Users\<\userpath\>\\npm-cache\\_git-remotes\\git-github-com-polymerelements-test-fixture-git-8142662e\\HEAD' }
18266 silly rollbackFailedOptional Starting
18267 silly rollbackFailedOptional Finishing
18268 silly runTopLevelLifecycles Finishing
18269 silly install printInstalled
18270 verbose stack Error: ENOENT: no such file or directory, scandir 'C:\Users\\<userpath\>\npm-cache\_git-remotes\git-github-com-polymerelements-test-fixture-git-8142662e\HEAD'
18271 verbose cwd C:\Users\\<userpath\>\git\PredixDev\predix-seed
18272 error Windows_NT 6.1.7601
18273 error argv "G:\\nodejs\\node.exe" "G:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "update" "--no-optional"
18274 error node v7.2.0
18275 error npm v3.10.9
18276 error path C:\Users\\<userpath\>\npm-cache\_git-remotes\git-github-com-polymerelements-test-fixture-git-8142662e\HEAD
18277 error code ENOENT
18278 error errno -4058
18279 error syscall scandir
18280 error enoent ENOENT: no such file or directory, scandir 'C:\Users\\<userpath\>\npm-cache\_git-remotes\git-github-com-polymerelements-test-fixture-git-8142662e\HEAD'
18281 error enoent ENOENT: no such file or directory, scandir 'C:\Users\\<userpath\>\npm-cache\_git-remotes\git-github-com-polymerelements-test-fixture-git-8142662e\HEAD'
18281 error enoent This is most likely not a problem with npm itself
18281 error enoent and is related to npm not being able to find a file.
18282 verbose exit [ -4058, true ]
I'm not familiar at all with using Node on Windows. Please help, thank you. (NOTE: I've replaced specific user folder information above with \ to sanitize the info.)
One possible cause is security software that filters access to the file system, like DigitalGuardian. If it's a corporate machine with something like that installed, you may need to get your IT people to whitelist Node.
https://github.com/npm/npm/issues/10729

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

Any npm's command is not working

I can attach the error log file
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\\node.exe',
1 verbose cli 'C:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'config' ]
2 info using npm#1.4.28
3 info using node#v0.10.35
4 verbose node symlink C:\Program Files\nodejs\node.exe
5 error Error: ENOENT, stat 'c:\'C:\Program'
6 error If you need help, you may report this entire log,
6 error including the npm and node versions, at:
6 error http://github.com/npm/npm/issues
7 error System Windows_NT 6.2.9200
8 error command "C:\Program Files\nodejs\\node.exe" "C:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js" "config"
9 error cwd c:\
10 error node -v v0.10.35
11 error npm -v 1.4.28
12 error path c:\'C:\Program
13 error code ENOENT
14 error errno 34
15 verbose exit [ 34, true ]
Any npm's command is not working.
I am using windows 8.1 and I installed npm successfully.
I heard that ENOENT error can be fixed if I make a folder relate to the error path but
error path contains 'C:\Program, I cannot make that file.
How can I solve this problem? I tried to uninstall npm, I failed.
This problem happened because I tried to change prefix for npm but something goes wrong
I found way to fix it.
OK, the reason why this problem happened was that I usually use CMD with administrator's admission.
Because of that setting, actually, I don't need to change prefix of npm but I just want to practice what I learn in my current book.
So I tried to change prefix but accidentally, Using
npm config set prefix C:\program files
I changed the prefix 'C:\program' like this.
because of special character : , I cannot create name of fold including : .
because of damn prefix, npm was totally not working.
I searched npm folder, I found npmrc file but it did not help.
Finally, I found .npmrc at C:\Users\myName .
there, the prefix was setted at C:\program .
I delete prefix and Now it is working!!!!!
Bye Bye let's master nodejs

"npm faq" fails on Windows 7 ("spawn ENOENT" errors)

I have installed node.js on Windows 7 with their latest installer. It seemed to work, I can call npm and node from the console (either cmd or PowerShell), but I keep getting errors.
There are a lot of questions here about node.js on windows, but they all mention some specific piece of code. I'm getting the "spawn ENOENT" with a lot of simple commands, for instance yo, if I then pick "update generators" :
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
even npm faq fails :
PS E:\www\something> npm faq
npm ERR! Error: spawn ENOENT
npm ERR! at errnoException (child_process.js:988:11)
npm ERR! at Process.ChildProcess._handle.onexit (child_process.js:779:34)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/isaacs/npm/issues>
It seems that the problem is that node uses unix command names like dir, which do not exist on Windows. Some blog posts mention using Cygwin, but mostly for building node.js, not for calling it. The official nodejs website doesn't mention that cygwin is a prerequisite, either.
Here's the npm-debug.log :
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'faq' ]
2 info using npm#1.3.24
3 info using node#v0.10.25
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 error Error: spawn ENOENT
5 error at errnoException (child_process.js:988:11)
5 error at Process.ChildProcess._handle.onexit (child_process.js:779:34)
6 error If you need help, you may report this *entire* log,
6 error including the npm and node versions, at:
6 error <http://github.com/isaacs/npm/issues>
7 error System Windows_NT 6.1.7601
8 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "faq"
9 error cwd E:\
10 error node -v v0.10.25
11 error npm -v 1.3.24
12 error syscall spawn
13 error code ENOENT
14 error errno ENOENT
15 verbose exit [ 1, true ]
Make sure that you have c:\Windows\System32 on your 'Path' System Variable. I was having this exact problem and this was the fix I needed. I must have taken it out in error sometime in the past.

Resources