LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-11-2024, 08:54 AM   #1
hljhende
LQ Newbie
 
Registered: Apr 2024
Posts: 1

Rep: Reputation: 0
Linux, node_modules, webpack issue


EDIT: I fixed it. The issue was NODE_ENV.
NODE_ENV was being changed from "development" to "production" by certain commands.
When NODE_ENV is set to production, devDependencies are not installed. So you should explicitly set it to 'development' by default.
It does seem to be linux related, because this issue isn't reproducable on windows.

Hey guys, newbie linux user here.

I'm having issues with node_modules and npm.
Our project is built in React & Node, and it works fine on other people's Windows machines - but not on my local linux.

Basically, I have a package.json which contains a list of all the required dependencies and devDependencies for a project.
When you run "npm install" this installs all said dependencies into node_modules.

However, when I try and build the project with 'webpack --mode production' I get an error saying webpack was not installed. It is definitely there in devDependencies...but it's not (usually) in node_modules. It's like the computer doesn't know where to look. It's also completely indeterministic, and node_modules sometimes has webpack and sometimes doesn't.

Similarly, with the webpack configuration, webpack.config.js
Webpack is supposed to load HtmlWebpackPlugin, like so:
const HtmlWebpackPlugin = require('html-webpack-plugin').

But it can't find it! html-webpack-plugin is clearly defined in package.json, although it doesn't seem to be in node_modules..

I've tried quite a few things, including uninstalling and reinstalling nvm, node and npm - to no avail.

What does fix the error is if I move all the devDependencies to dependencies in package.json - but that's obviously not ideal for development.

I'm wondering if this has something to do with how linux finds files, but it's completely baffling me. Any help would be greatly appreciated.

Thanks!

Last edited by hljhende; 04-12-2024 at 02:36 AM.
 
Old 04-12-2024, 04:53 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,863

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
in that case you might want to mark the thread solved.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Faster Tied Together: Bundling Your App with webpack LXer Syndicated Linux News 0 08-01-2017 02:09 AM
LXer: Faster Tied Together: Bundling Your App with webpack LXer Syndicated Linux News 0 07-31-2017 10:24 PM
Xilinx webpack 9.2i installed but not running fireball003 Linux - Software 0 05-05-2007 11:18 PM
LXer: Xilinx Releases ISE WebPACK 8.2i - FPGA Industry's Only Free Fully Featured Design Suite LXer Syndicated Linux News 0 07-17-2006 09:33 PM
LXer: Xilinx Announces 8.1i Release of WebPACK - Industry's Only Free Fully Featured Design Suite LXer Syndicated Linux News 0 01-10-2006 05:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration