Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

172
Vistas
Cannot find node module in rails stimulus controller

I have a problem with importing an npm package that I have created into my rails application.

I'm unsure if the problem is in the way I have created the node package or with the rails app.

The package is very simple -> https://www.npmjs.com/package/test-release-stuff

Now when I'm trying to import it into rails (I install it vie yarn and then see it's in the node modules) and I try to import it into my stimulus controller it tells me that it can't find the module. The error literally says:

Error: Cannot find module 'test-release'stuff'

How I'm importing the module?

I'm doing import foo from 'test-release-stuff'

One thing to note is that when I tried that in a simple react todo app it was imported without any issues.

I have a feeling that it might be something with the webpacker config in my rails app (below is the config) or that it might be something with the node packaga packgage.json file, there might be something incorrect there.

const { webpackConfig, merge } = require('@rails/webpacker');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const plugins = [];

if (process.env.ANALYZE === 'true') {
  plugins.push(new BundleAnalyzerPlugin());
}

const customConfig = {
  resolve: {
    extensions: ['.css'],
  },
  plugins: plugins,
};

module.exports = merge(webpackConfig, customConfig);

then in the production/development/test files I have something like this:

process.env.NODE_ENV = process.env.NODE_ENV || 'production';

const webpackConfig = require('./base');

module.exports = webpackConfig;

It's a rails 6 project.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Turns out it was neither rails app fault or the node package fault.

I'm running the project inside the container. Although I installed once the previous version of that node package, when updating it, the changes were not properly reflected inside the container - I assume at some point the actual yarn command was not firing or that there was some caching involved.

After properly bringing the containers down, running docker-compose build and docker-compose up the changes were reflected and I can use the node package.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda