Comments (17)
It looks like your operating system put an invalid name in your node_modules folder. npm can't support things like this, it has to assume everything in there is something it put there. It has to error to let you know that you are now going to get unexpected results.
npm update -g
does work. Because there is no global manifest it will always update to the latest version.
The solution here is to remove those files that osx put there, and configure it to stop doing that.
from cli.
I don’t understand why this issue is closed. This should be handled by npm
, not macOS. There’s no way to disable '.DS_Store' for a single folder. A workaround is to add find "$(npm list -g | head -1)" -name '.DS_Store' -type f -delete
to your shell startup files, but that’s awkward. Good software should accommodate users, not the other way around.
from cli.
It looks like your operating system put an invalid name in your node_modules folder.
As we all know, macOS may place a .DS_Store
file in any directory.
It's unimaginable that npm doesn't handle it.
it has to assume everything in there is something it put there
Too idealistic.
The solution here is to remove those files that osx put there, and configure it to stop doing that.
This is not a solution.
I'm starting to understand why npm is the default package manager distributed with node, but people still invent alternatives.
I will move to yarn or pnpm, whatever.
from cli.
Why is prefix
set?
from cli.
Why is
prefix
set?
I just want to custom it.
from cli.
Why? npm only comes with node, so it should only be located in the location that node ships it in.
from cli.
Why? npm only comes with node, so it should only be located in the location that node ships it in.
I separated them.
I manually installed node to /opt/node/node
, and set npm prefix to /opt/node/npm
.
This has nothing to do with why I set the prefix
, so far everything works fine with my configuration instead of this issue.
It seems that npm did not use the correct filter results when scanning the global lib directory, which caused this problem.
And here is a related issue in old repo.
npm/npm#20493
from cli.
prefix
changes npm root -g
, so it very well might be related. Have you tried a standard unmodified install to see if it's your modifications causing the problem?
from cli.
prefix changes npm root -g, so it very well might be related. Have you tried a standard unmodified install to see if it's your modifications causing the problem?
Would you please try following steps to repro.
touch "$(npm config get prefix)/lib/node_modules/.DS_Store"
npm update -g
from cli.
I definitely get the same error, but npm update -g
isn't a command that should work anyways, since there's no global package.json to update. Global packages need to be updated manually, one at a time.
from cli.
npm update -g
isn't a command that should work anyways.
The help message says it is ok.
<pkg>
is optional.
from cli.
Seems like two legit issues: a documentation error, as well as "it should be failing with a clearer message".
from cli.
I bet npm update -g
works fine, I often do it. This can easily update all global libraries.
The only problem is that .DS_Store
is not filtered out correctly.
In addition to .DS_Store, there may be some other files that need to be filtered.
But at least all regular file type should be excluded from the results and only the folder type should be kept as package name.
from cli.
BTW, npm list -g
works fine with .DS_Store
.
from cli.
I tried change line 445 to following, and it works.
const paths = (await readdirScoped(nm).catch(() => []))
.filter(p => p !== '.DS_Store')
Maybe we should fix it in readdir-scoped.js
cli/node_modules/@npmcli/fs/lib/readdir-scoped.js
Lines 1 to 20 in e9fdc9a
from cli.
Possibly better logic would be, to filter out anything that can’t be a valid package name?
from cli.
Possibly better logic would be, to filter out anything that can’t be a valid package name?
I agree, Maybe we should refer to npm list -g
, since it works fine.
from cli.
Related Issues (20)
- [BUG] DevDependancy are installed in production when also marked as peerDependenciesMeta optional HOT 3
- [question] Whether it is possible to upload to npmjs.org manually? HOT 1
- [BUG] `npm outdated --json` doesn't provide distinct workspace packages information HOT 1
- [BUG] git dependencies cause weird behaviour when git is not installed HOT 2
- [BUG] DevDependancy are installed in production when also marked as optional peerDependencies HOT 8
- [BUG] outdated does not report packages in unnamed workspaces HOT 1
- [BUG] Inconsistent audit json HOT 3
- [BUG] `npm i` does not set `["packages"][""]["name"]` in package-lock.json when there is no name in package.json while `npm audit fix` sets that to project's directory name HOT 7
- [BUG] `npm install` sometimes removes indirect dependencies if a parent node was deleted from the lockfile HOT 2
- [BUG] The .gitignore file is renamed to .npmignore when npm install HOT 2
- [BUG] The package-lock.json file depends on node_modules, which will cause the lock generated by npm i to be inconsistent after the lock file is deleted when some packages that depend on the system architecture (such as node-unix-socket) are installed again. HOT 3
- Start HOT 1
- [BUG] Project name was being added to dependencies automatically HOT 7
- Align npm packages to npm 10's node engine range
- Problem: CORS Error When Accessing Swagger API Deployed on AWS EC2 HOT 1
- Error: The programmatic API was removed in npm v8.0.0 HOT 7
- [BUG] npx fails to find local packages in project directory when using fnm HOT 1
- [BUG] `npm pack` marks the wrong files as executable
- npm error code ENOENT npm error syscall lstat npm error path C:\Users\hoang\AppData\Roaming\npm npm error errno -4058 npm error enoent ENOENT: no such file or directory, lstat 'C:\Users\hoang\AppData\Roaming\npm' npm error enoent This is related to npm not being able to find a file. npm error enoent npm error A complete log of this run can be found in: C:\Users\hoang\AppData\Local\npm-cache\_logs\2024-09-02T15_31_36_800Z-debug-0.log HOT 1
- [DOCS] arborist doesnt mention pnpm and yarn support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.