Atom hangs/crashes when installing a npm module


#1
  • Linux Mint 18.3 (4.10.0.26-generic x86_64)
  • Atom 1.23.3 x64
  • 3rd party packages:
  • autoclose-html
  • file-icons
  • highlight-selected
  • language-babel
  • pigments
  • Themes:
  • UI - Solarized Dark (solarized-dark-ui)
  • Syntax - Babel React (babel-react-syntax)

Steps to recreate:

  1. Open terminal at app root
  2. npm i -S
  3. Atom hangs and/or crashes

Video:


#2

I know why this is happening. Atom is a busybody that cares a lot about the user’s files and will explore any directory tree you have open to take a peek at every file therein. Installing a Node module adds a lot of new files, but Atom doesn’t usually check node_modules/ because it’s automatically in every .gitignore file. The node_modules/ in skunkworks/client/, however, is being checked, as indicated by the fact that it’s not darkened. Atom is just choking on processing so many new files at once. The easiest fix is to add */node_modules/ to your .gitignore for any project with nested repos like this.


#3

Checked app level and client level .gitignores and both have node_modules included.

Double checked my github repo and confirmed neither node_modules folder is being tracked:


#4

The crash only seems to trigger when the package.json is updated via npm (v5.6.0).


#5

Don’t look at the GitHub repo. Atom doesn’t know anything about the GitHub repo. Look at the colors of the folders displayed in Atom. That tells you everything. Atom thinks that client/node_modules is a tracked folder in the project skunkworks because it hasn’t been told otherwise.


#6

The theme might be throwing you off. Here’s what’s tracked (no mention of node_modules):


#7

Double checked and tried to remove the cached folder directly:


#8

.gitignore client:

See https://help.github.com/ignore-files/ for more about ignoring files.

dependencies

/node_modules

testing

/coverage

production

/build

misc

.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*


#9

.gitignore app:

Mac OS BS

*.DS_Store

Client files and folders

client/build
client/etc
client/src/styles/assets
client/src/styles/styles.css
client/scripts
client/src/images
client/node_modules

Server files and folders

uploads/
scrap/
prod.json
flightplan.js

Config

**/config

Logs

logs
*.log

Runtime data

pids
*.pid
*.seed

package-lock

*package-lock.json

Directory for instrumented libs generated by jscoverage/JSCover

lib-cov

Coverage directory used by tools like istanbul

coverage

Grunt intermediate storage

.grunt

node-waf configuration

.lock-wscript

Compiled binary addons

build/Release

Dependency directory

node_modules/

Public assets directory

app/public/assets

Debug log from npm

npm-debug.log

sass

.sass-cache/
*.css.map

ngrok

ngrok


#10

Extra steps:

  • Renamed ~./atom to ~./atom_backup (still crashes)
  • Started app with atom --safe (still crashes)
  • Cleared atom window state (still crashes)

Happens randomly, as you can see here (I installed, uninstalled, reinstalled, then it crashed):


#11

You’re asking git what it thinks the tracked files are. Git probably knows on its own how to ignore the .gitignored folders of submodules. Atom doesn’t care what you’ve added, and Atom isn’t asking git for its opinion.

In all of your tests, have you tried my suggestion at the top of this thread?


#12

Tried your suggestion (added to both app and client .gitignore and committed)… no difference:

See my above post “Extra Steps” screenshot to see that node_modules isn’t being tracked (running default theme without any packages)!


#13

Switched to an older disk (which runs Linux Mint 18.1) that I use for emergency backups/testing and npm installing/uninstalling works again (package versioning in screenshot):


#14

Maybe something has changed since 1.18.0. I remember that, around 1.19.0, a lot of people had performance issues because the GitHub package started tracking files in git repos up the directory tree from a project folder open in Atom. That primarily affected Macs, and appeared to be the result of a lot of people having .git/ folders in their user folders.