I am behind a corporate proxy and so am installing npm packages via the downloaded tar files. It's worked just fine for alot of packages, however, I have come across the following error when attempting to install the Vue CLI:
Can't install ... Missing package name
I have not found much reference to this error elsewhere. Wondering if someone can point me in a direction on this.
Related
I'm trying to run a simple hello.ts script from command line. This works if the script has no dependencies:
npx ts-node hello.ts
But as soon as I start adding some dependencies...
import _ from 'lodash';
console.log('hello');
It fails:
Cannot find module 'lodash' or its corresponding type declarations.
It keeps failing even if I install the dependencies globally. So how do I tell npx (or ts-node for that matter) to consider globally installed dependencies?
Update
Using Node 16.9.1 (upgraded via Version Lens). The error seems to have disappeared after uninstalling/reinstalling the imported libraries a few times.
If you're using npm >=1.0, you can use npm link to create a local link to a package already installed globally. (Caveat: The OS must support symlinks.)
IE: npm install -g lodash && npm link lodash
However, this doesn't come without its problems.
npm link is a development tool. It's awesome for managing packages on your local development box. But deploying with npm link is basically asking for problems, since it makes it super easy to update things without realizing it.
As an alternative, you can install the packages locally as well as globally.
For additional information, see:
https://nodejs.org/en/blog/npm/npm-1-0-link/
https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/
Are you using the n package by any chance? I used n to change from a newer version of node (16.2.0) to an older version of node (12.13.0), ran npm i and npx failed with a different error.
Using n to change back to 16.2.0 seems to have resolved the issue so I'm thinking perhaps it was an issue with package-lock.json or such
I'm having trouble installing node packages. I know that packages are now installed to AppData\Roaming on WIN10, but for me this is an issue because my company's login script makes my user profile set to another drive, for example U:\
So when I use npm to install a package, like typescript, the package gets installed to the wrong directory and a global package is not found.
Changing my .npmrc file to the below resolved the issue.
prefix=${APPDATA}\npm
Thanks to nodejs npm global config missing on windows
I have found a react-native module I would like to use. It contains an error which prohibits the installation.
I have forked the repository and corrected the mistake.
Now I want to install my module in order to use it, however during execution of the post installation scripts I get an error - file not found.
I have tried to find the reason for it, but the reason is quite simple, the module is not in the node_modules directory, and when npm tries to "enter" there to run the scripts, it can't find them.
I have tried to check where this is installed, but I can't.
I use npm install <user>/<repo> to install my module.
I am trying to upload npm libraries on a Nexus Repository Manager 3.1. which is on a server. This server does not have internet access.
So, I did a npm install on another computer in order to have the needed libraries for npm. After that, I tried to publish them on the Nexus Repository Manager by doing: npm publish “lib” – registry “repo adress”.
It didn't work for 41 libraries: acorn, bluebird, clean-css, colormin, cssnano, csso, ent, event-stream, form-data, glob, gulp, is-extglob, kind-of, parse-glob, postcss-colormin, postcss-convert-values, postcss-discard-comments, postcss-discard-duplicates, postcss-discard-empty, postcss-discard-unused, postcss-filter-plugins, postcss-merge-idents, postcss-merge-longhand, postcss-merge-rules, postcss-minify-gradients, postcss-minify-params, postcss-minify-selectors, postcss-normalize-url, postcss-ordered-values, postcss-reduce-idents, postcss-reduce-initial, postcss-reduce-transforms, postcss-selector-parser, postcss-svgo, postcss-unique-selectors, q, spdx-expression-parse, useragent, void-elements, xml-char-classes, xmlbuilder.
Sometimes the errors are that librairies are missing. For instance when I try to publish the q library, the error was that grunt was missing. Therefore, I published it on the repo but I still have errors which are:
Failed to exec prepublish script
verbose stack Error: q#1.4.1 prepublish: grunt
Moreover, when I try to install the acorn library the problem was that a library was missing. When I published the missing library on the repo, another library was missing and again and again.
How do i do to publish all the libraries on the repo ?
I have the 3.10.9 version of npm.
I suspect the answer is because all of those packages have dependancies. So the errors you are getting are with the related dependancies. You could probably push the packages by removing the dependancies from the package.json however, when you went to use these packages they wouldn't work because they don't have the dependancies.
Thus, I don't think there's any viable workaround here. I believe the issue is because you're not on the internet and has nothing to do with Nexus.
When I do npm list --global, one package, phonegap, shows as invalid.
npm ERR! invalid: phonegap#5.0.0-0.28.1 /usr/local/lib/node_modules/phonegap
No other packages have any errors or problems. I’ve tried to look into this, and learned that the message means a dependency is unfulfilled, but I can’t figure out which one. If I run npm update --global phonegap it exits cleanly, with no errors.
I originally installed npm & node via Homebrew, if that’s relevant. Here’s my full list of globally installed packages.
How do I diagnose this?
Have you tried changing the permissions for that package? I recently had a similar problem with global packages and it turned out to be a permissions issue
https://docs.npmjs.com/getting-started/fixing-npm-permissions