_This is an old issue I submitted to terminal-plus which I think was never resolved. On a side note, thank you for forking terminal-plus and working on this, after the 1.7.1 update it broke and luckily this version of the package worked._
When I type npm install it does literally nothing, no errors are logged.
After a long search I've read that the NODE_ENV variable within Atom itself is leaking into terminal plugins, this is always set to production therefore directly affecting the npm install command and preventing me from installing devDependencies.
Seems to be fixed in terminal-plus itself. Check this commit: 64058bf8ae12d7b3d5e69af305cba4968f86f73d
echo $NODE_ENV in terminal gives me an empty string, while console.log(process.env.NODE_ENV) in developer tools console prints production. I don't see a leaking of NODE_ENV variable.
I tested this just now and confirmed that this issue still exists.
Allow me to explain. In my project I have a package.json file like this:
{
"name": "project-name",
"version": "1.0.0",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-include": "^2.1.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.2.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^1.5.3",
"gulp-watch": "^4.3.5"
}
}
So, I go into atom, open platformio (or terminal-plus) and type npm install.
This is what it shows me:
As you can see it simply showed warnings but installed nothing. It does create a node_modules folder but the folder is empty.
As I mentioned above, I've done some searching around and the explanation seems to be that when I use the npm install command from within the terminal in Atom, it takes Atom's NODE_ENV which is always set to production. The npm install command takes this configuration and will only install dependencies and not devDependencies.
The instance of node installed on my (Windows) machine however has its NODE_ENV set to development. And when I use npm install I want it to refer to that variable instead.
I would also like to note that I've tested using the npm install command outside of platformio/terminal-plus (separate cmd/powershell window). In this case it installs all the packages successfully because NODE_ENV is correctly set to development and it is not being overridden by Atom.
Yes of course, why not just use that method instead? But that would defeat the purpose of having a terminal directly built-in to atom, not having to switch between the editor and a separate terminal window all the time.
Another Similar Issue:
https://github.com/blueimp/atom-open-terminal-here/issues/7
I tried your package.json and npm installed devDependencies.
Can you please check the actual value of the NODE_ENV variable? I guess, it's Get-ChildItem Env:NODE_ENV in PowerShell.
By the way, the related issues I found state that this is a Windows-specific issue. So this problem might be impossible to replicate on Linux and OS X.
env is initialized right here: https://github.com/platformio/platformio-atom-ide-terminal/blob/master/lib/process.coffee#L16
As you can see, NODE_ENV gets omitted from the initial env along with other atom-specific variables. I am not sure why that does not work on Windows. Please let me know if you make any progress on this!
The problem went away after uninstalling and installing node again. Sorry about that.
Same problem here.
If i run npm config ls -l then i found this:

Which is definitely comes from Atom terminal because if i run the same command in Windows cmd or git-bash terminal then production=false.
Also production is false by default by NPM in the userconfig and in globalconfig as well.
Anybody is dealing with this issue??
Thanks
Same issue here on Windows 10. I can confirm everything raniesantos and fodurr said about the issue, except that I tried uninstalling Node and installing again (as suggested by raniesantos), but that didn't help. Still having production=true only in Atom terminal.
You can write Auto Run command on terminal initialization
set NODE_ENV=development

I'm not sure is good idea, but it's work.
npm config get production
true in Atomfalse in Windows Command PromptThis issue is still present on Windows 10. I tried Sayto fix and it didn't work for me, there's however a different way. Open Terminal and execute:
npm config set -g production false
That will add value production=false to a file npmrc inside folder %AppData%\npm\etc. I don't like this "solution" very much, it should be properly fixed in atom/platformio-atom-ide-terminal. You can also create file .npmrc (notice the dot in the file) with value production=false only inside your project and that will work too.
Another workaround that I would recommend more because it doesn't mess with environment variables is to run this command after you ran your npm install:
npm install --only=dev
That will force installing packages from devDependencies no matter the production variable value.
@klofi I tried what you mentioned even if in npm config files set production to false still the terminal uses production=true, so for me your proposal does not work.
but anyway it seems the developer of this terminal does not care, so I use other terminals and other IDE since that.... :((
@fodurrr That's a shame, thought at least one of those would work. When you find a good terminal please let me know, I switched to platformio-atom-ide-terminal from terminal-plus and really like it other than this issue and no Ctrl+V paste.
This seems to be a bigger issue, unrelated to this terminal, see: https://github.com/atom/atom/issues/3099.
A possible solution is running atom in development mode.
@Shogun137 it didn't work for me when i reinstall node.
@fodurrr I use platformio-atom-ide-terminal too,but the problem is the same to this issue,with prodution=true default,how to fix it?in windows.
@Klemensas how to run atom in dev mode?
Anybody is dealing with this issue??
Thanks
same issue here... had to npm install outside of IDE.. npm install --only=dev doesn't work either..
@Shogun137 @zp1112 that command only works in windows command prompt not the default terminal in platformio-ide-terminal which is Powershell
In Windows If you are using the default shell in platformio-ide-terminal, i.e. Powershell, in the "Auto Run Command" field, enter: $env:NODE_ENV="development"
If you override the default shell:
with Windows Command Prompt, enter: set NODE_ENV=development
with git bash, enter: NODE_ENV=development
I can confirm this issue exists for other terminal plugins for Atom.
Same Issue on macOS with latest version of Atom and plugin.
Can confirm on MAC OS using VS Code. Choosing the "Open Terminal" option from within GitKraken cause the NODE_ENV to be set to 'production.
THE FIX:
1) In Terminal, run command unset NODE_ENV
2) Exit code editor of choice
3) Then instead of using the client's built-in "Open Terminal" option. Change dir to appropriate repo then launch code editor from in-line
NOTE: You don't have to launch code editor from inside terminal. You just have to make sure YOU UNSET the NODE_ENV that is set when starting the terminal from the GitKraken client.
To the GitKraken team, please look into this issue!
Most helpful comment
@Shogun137 @zp1112 that command only works in windows command prompt not the default terminal in platformio-ide-terminal which is Powershell
In Windows If you are using the default shell in platformio-ide-terminal, i.e. Powershell, in the "Auto Run Command" field, enter:
$env:NODE_ENV="development"If you override the default shell:
with Windows Command Prompt, enter:
set NODE_ENV=developmentwith git bash, enter:
NODE_ENV=developmentI can confirm this issue exists for other terminal plugins for Atom.