Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.3K
Visualizações
How do I add a symlink from project's node_modules?

I've been following a tutorial on how to code a Password Manager using React, Node.js and MYSQL. I suddenly got this error telling me the file, /EncrpytionHandler, falls outside of the project src/ directory. Though, the file structure is the same as it is in the video. I'm not sure what to do, being that even when I do move the file, the error still occurs. Here is the video to the tutorial and a screeshot of my workspace:

Compiled with problems: ERROR in ./src/App.js 9:0-66 Module not found: Error: You attempted to import ../../server/EncryptionHandler which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.

Coding a Password Manager - ReactJS, NodeJS, MySQL

Image of my workspace

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You attempt to import file outside of the project src/ directory. This functionality was added to "create-react-app" not so long ago. You might want to resolve it by simply adding the same file to your frontend app, say, to src/util/ directory, or proceed with this answer:

ReactJS import component outside src/ directory

about 4 years ago · Juan Pablo Isaza Relatório

0

Note that you have run the server on the src folder, so it is normal for it to run as the root directory of your server process, so this process has no right to exit its root, so it is best to add this module to the src folder To make exporters available in that folder, otherwise you can create a Symlink for it as follows:

create this file with name "createSym.js" in src dir and And put the following program in it :

// Node.js program to demonstrate the
// fs.symlink() method
  
// Import the filesystem module
const {symlink} = require('fs');
  
symlink("../../server/EncryptionHandler.js",
        "./EncryptionHandler.js", 'file', (err) => {
  if (err) console.log(err)
  else console.log("done");
);

and run this with node in src directory<as current work director(cwd or pwd)>

node createSym.js

Note that to do this, you need to have the required permission

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda