NPM has stopped working on Windows 7 64bit, hangs on install/update - windows

At some point my version of NPM stopped working. It seems to have happened when I tried to update npm (from 1.4 shipping with node to a modern 2.x version) a few weeks ago and has steadily gotten worse. I had to change the Environment variable to point to my npm directory before my node directory (to pick up the new version of npm), at that point everything just stopped working. I switched the environment variable back, and then updates would just hang. But strangely when I tried to debug it and add a --verbose to the command the update would work most of the time. Sometimes they hung on the
npm http GET https://registry.npmjs.org/PACKAGE_NAME
but most of the time they worked. This now happens with the old version of NPM (1.4.1) and the new version that I installed (2.1.17), everything always fails on a GET command (usually but not always the first one). I have hit cache-clear, I have wiped out the temp directory, I have tried wiping out %APPDATA/roaming/npm/, and reinstalling everything. I have no proxy in place, but I have run:
npm config set proxy
to set the proxy to blank. I have set the registry to http (rather than https) and set strict-ssl to false. I have uninstalled and reinstalled nodejs, to no luck. I have tried running the commands from an admin cmd prompt rather than a normal command prompt all to no avail. I've run out of ideas, and really need NPM to work...
Below is the output of trying to install grunt-cli after clearing out the %APPDATA/roaming/npm directory:
C:\Users\Kris Erickson>npm install -g grunt-cli --verbose
npm info it worked if it ends with ok
npm verb cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli 'install',
npm verb cli '-g',
npm verb cli 'grunt-cli',
npm verb cli '--verbose' ]
npm info using npm#1.4.28
npm info using node#v0.10.35
npm verb node symlink C:\Program Files\nodejs\\node.exe
npm verb cache add [ 'grunt-cli', null ]
npm verb cache add name=undefined spec="grunt-cli" args=["grunt-cli",null]
npm verb parsed url { protocol: null,
npm verb parsed url slashes: null,
npm verb parsed url auth: null,
npm verb parsed url host: null,
npm verb parsed url port: null,
npm verb parsed url hostname: null,
npm verb parsed url hash: null,
npm verb parsed url search: null,
npm verb parsed url query: null,
npm verb parsed url pathname: 'grunt-cli',
npm verb parsed url path: 'grunt-cli',
npm verb parsed url href: 'grunt-cli' }
npm verb lock grunt-cli C:\Users\Kris Erickson\AppData\Roaming\npm-cache\671ef8ac-grunt-cli.lock
npm verb addNamed [ 'grunt-cli', '' ]
npm verb addNamed [ null, '*' ]
npm verb lock grunt-cli# C:\Users\Kris Erickson\AppData\Roaming\npm-cache\d63f3d0b-grunt-cli.lock
npm verb request where is /grunt-cli
npm verb request registry https://registry.npmjs.org/
npm verb request id dc44ca4b260df8c3
npm verb url raw /grunt-cli
npm verb url resolving [ 'https://registry.npmjs.org/', './grunt-cli' ]
npm verb url resolved https://registry.npmjs.org/grunt-cli
npm verb request where is https://registry.npmjs.org/grunt-cli
npm info trying registry request attempt 1 at 13:36:28
npm http GET https://registry.npmjs.org/grunt-cli
/
Note: the spinner never stops (at least I have left it 10 minutes and nothing happened).

It looks like you may have installed a new npm but it is not actually being used (or did you revert back to 1.4.28?)
In either case, try following the directions here https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows for updating to the latest npm on Windows. Latest is currently 2.4.1. I recommend using Option 3.
Then try running your npm install command with maximum verbosity:
npm -ddd install -g grunt-cli
and upload your logfile as a gist https://gist.github.com either here or as a new issue at https://github.com/npm/npm/issues, and we'll help you get this sorted out.

The version number you're using doesn't comply with the semantic versionning convention npm uses: you need to specify a MAJOR.MINOR.PATCH version number.
You can either:
Use the 0.2.x notation to specify that you don't care what patch version you use, as long as the major.minor matches
Use the ~0.2.0 notation to specify that you don't care what patch version you use, as long as the major.minor matches
Read npm's documentation and semver's documentation for other possibilities...
Hope This helps.

I am running node in windows 8.1. This issue popped up on a new machine build and I searched for hours for a resolution with no success. Finally. in desperation I used fiddler in an attempt to see what calls were being made by npm AND magically the problems went away.
On further investigation I found that npm appears to require two windows environment variables to be set:
Try the following in a command prompt before running npm (Note: if you are actually behind a proxy then replace the empty quotes with your proxy address):
Setx http_proxy ""
Setx https_proxy ""

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.

How to fix EACCES: permission denied, open '/Users/.... when installing gatsby-cli

I'm setting up Gatsby and get stuck at the beginning.
When i write npx/npm install global gatsby-cli in the terminal -
Alems-MacBook-Pro:~ alemkahrobek$ npm install -g gatsby-cli i see this:
/usr/local/bin/gatsby -> /usr/local/lib/node_modules/gatsby-cli/lib/index.js
gatsby-telemetry#1.0.4 postinstall /usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry
node src/postinstall.js
gatsby-cli#2.5.4
added 225 packages from 131 contributors in 13.617s.
If i check the version of gatsby i get this:
Alems-MacBook-Pro:~ alemkahrobek$ gatsby -v
/usr/local/lib/node_modules/gatsby-cli/node_modules/configstore/index.js:49
throw error;
^
Error: EACCES: permission denied, open '/Users/alemkahrobek/.config/gatsby/config.json'
You don't have access to this file.
at Object.openSync (fs.js:439:3)
at Object.readFileSync (fs.js:344:35)
at Configstore.get all [as all] (/usr/local/lib/node_modules/gatsby-cli/node_modules/configstore/index.js:31:25)
at new Configstore (/usr/local/lib/node_modules/gatsby-cli/node_modules/configstore/index.js:25:48)
at new Store (/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry/lib/store.js:28:51)
at new EventStorage (/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry/lib/event-storage.js:24:50)
at new AnalyticsTracker (/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry/lib/telemetry.js:32:50)
at Object.<anonymous> (/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry/lib/index.js:7:18)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10).
Now if i try to make a new project like:
gatsby new example
i get this:
Alems-MacBook-Pro:~ alemkahrobek$ npm gatsby new example
Usage: npm <command>
where <command> is one of:
access, adduser, audit, bin, bugs, c, cache, ci, cit,
clean-install, clean-install-test, completion, config,
create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
edit, explore, get, help, help-search, hook, i, init,
install, install-ci-test, install-test, it, link, list, ln,
login, logout, ls, org, outdated, owner, pack, ping, prefix,
profile, prune, publish, rb, rebuild, repo, restart, root,
run, run-script, s, se, search, set, shrinkwrap, star,
stars, start, stop, t, team, test, token, tst, un,
uninstall, unpublish, unstar, up, update, v, version, view,
whoami
npm <command> -h quick help on <command>
npm -l display full usage info
npm help <term> search for help on <term>
npm help npm involved overview
Specify configs in the ini-formatted file:
/Users/alemkahrobek/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
npm#6.9.0 /usr/local/lib/node_modules/npm
Alems-MacBook-Pro:~ alemkahrobek$ npm help config
NPM-CONFIG(1) NPM-CONFIG(1)
NAME
npm-config - Manage the npm configuration files
SYNOPSIS
npm config set <key> <value> [-g|--global]
npm config get <key>
npm config delete <key>
npm config list [-l] [--json]
npm config edit
npm get <key>
npm set <key> <value> [-g|--global]
aliases: c
DESCRIPTION
npm gets its config settings from the command line, environment vari-
ables, npmrc files, and in some cases, the package.json file.
See npm help 5 npmrc for more information about the npmrc files.
See npm help 7 npm-config for a more thorough discussion of the mechanisms involved.
The npm config command can be used to update and edit the contents of
the user and global npmrc files.
Sub-commands
Config supports the following sub-commands:
set
npm config set key value
Sets the config key to the value.
If value is omitted, then it sets it to "true".
get
npm config get key
Echo the config value to stdout.
list
npm config list
Show all the config settings. Use -l to also show defaults. Use --json
to show the settings in json format.
delete
npm config delete key
Deletes the key from all configuration files.
edit
npm config edit
Opens the config file in an editor. Use the --global flag to edit the
global config.
SEE ALSO
o npm help 5 folders
o npm help 7 config
o npm help 5 package.json
o npm help 5 npmrc
For Ubuntu users who experience the same problem, I've solved it giving the right permissions on the specified folder:
chown -R $USER:$USER /home/$USER/.config/gatsby
Check out the official page on npmjs.com: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
I would definitely the first option on that page. nvm is pretty awesome: https://github.com/creationix/nvm

With Node 0.12.2 and npm 2.7.4 ionic installation error on windows 7

I am downloaded the node installation file "node-v0.12.2-x64.msi" for 64 bit windows 7 OS. All node and npm commands are working fine. I checked both the node and npm versions.
But when I try to install ionic by the following command:
npm install -g cordova ionic
Its gives me the following error:
npm WARN engine cordova-js#3.9.0: wanted: {"node":"~0.10.x"} (current: {"node":"
0.12.2","npm":"2.7.4"})
npm WARN engine npm#1.3.4: wanted: {"node":">=0.6","npm":"1"} (current: {"node":
"0.12.2","npm":"2.7.4"})
npm WARN engine xmlbuilder#2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {
"node":"0.12.2","npm":"2.7.4"})
npm WARN installMany normalize-package-data was bundled with npm#1.3.4, but bund
led package wasn't found in unpacked tree
npm ERR! tar.unpack untar error C:\Users\Biswarup\AppData\Local\Temp\npm-1484-8b
f97a1e\registry.npmjs.org\request\-\request-2.9.203.tgz
npm ERR! cb() never called!
Biswarup is my username in above all cases.
I check the following links for troubleshooting, but nothing works for me.
https://github.com/npm/npm/wiki/Troubleshooting#error-enoent-stat-cusersuserappdataroamingnpm-on-windows-7
https://github.com/diegonetto/generator-ionic/issues/42
Please guide me, I am totally stuck at that point. Try to removing node js and reinstalling it many times. But nothing goes right.
First of all packages warning you, that it requires nodejs 0.10.x and may be that is a reason.
Another try you can upgrade npm and try to found new version. So here steps to do it:
npm cache clean
npm update -g npm
npm cache clean
Please download Node 0.10.38
I was too having problem with newer version of node.
I have already aswered this in detail https://stackoverflow.com/a/31124491/1276616

smash: command not found (npm)

I am trying to install an Elm-d3 connector I found on Github.
Elm is a functional-reactive programming language Evan Czaplicki
d3.js is the popular graphics meta-library by Michael Bostock
Elm-d3 enables you create type-safe, composable widgets using HTML, SVG, and CSS. D3 acts as a conceptual basis for the library, as well as an alternative renderer for Elm.
The first two install instructions are:
npm install smash
make
Installing smash goes smoothly (although I have to use sudo)
npm http GET https://registry.npmjs.org/smash
npm http 304 https://registry.npmjs.org/smash
npm http GET https://registry.npmjs.org/queue-async
npm http GET https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/queue-async
npm http GET https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/wordwrap
smash#0.0.12 ../../../node_modules/smash
├── queue-async#1.0.7
└── optimist#0.3.7 (wordwrap#0.0.2)
However after installing I can't seem to refer to smash, which merges Javascript files together into one.
$ smash
bash: smash: command not found
I don't think node.js is actually used anywhere, just organized by npm. Why can't I find smash after installing it?
When I try to run make I get related errors:
make: node_modules/.bin/smash: Command not found
make: Nothing to be done for `all'.
If you want to use smash (or just about any other npm program) from your bash prompt you need to install it globally by using the -g flag.
npm install -g smash

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.

Resources