Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.env NODE_PATH is not working in v1.0.0

See original GitHub issue


I have NODE_PATH=src in .env, it did work great in v0.9.5. After yarn upgrade react-scripts it doesn’t work now. And I didn’t see any related guide in the v1.0.0 changelog.

(referenced from

I’ve also tried in a fresh new project and it doesn’t work.

Expected behavior

Should be able to import 'foo/bar' which foo is a folder located in src

Actual behavior

Module not found: Can't resolve 'foo/bar' in '/Users/some/path/src'


Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected): v1.0.0
  2. node -v: v7.1.0
  3. npm -v: v3.10.9

Then, specify:

  1. Operating system: macOS Sierra
  2. Browser and version: Chrome 58

Reproducible Demo

This is a fresh new project. See /src/index.js:5

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:39 (27 by maintainers)

github_iconTop GitHub Comments

CodinCatcommented, May 19, 2017

Would you consider adding Webpack alias? I really think that NODE_PATH is just some kind of escape hatch to get rid of relative paths and might lead to some naming conflict. It would be really more convenient If we can have an alias.

I think the idea in Vue webpack template is great: (

alias: {
  '@': resolve('src')

so you can

import Hello from '@/components/Hello'

and it’s totally optional for users. Anyone who prefer relative paths can simply keep using them and ignore the alias. Of course it doesn’t need to be @, this can be discussed.

ingrocommented, May 19, 2017

Thanks for the suggestion @RIP21 but still not working for me, I was already running tests like this:

"scripts": {
   "test:cra": "react-scripts test --env=jsdom",
   "test": "cross-env NODE_PATH=./src npm run test:cra"
Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactJS 'NODE_PATH' is not recognized as an internal or ...
Im running node v17.5.0 using npm 8.4.1 . NB!! All the files below are located in the root of my project. This is...
Read more >
Command-line API | Node.js v19.3.0 Documentation
The program entry point is a specifier-like string. If the string is not an absolute path, it's resolved as a relative path from...
Read more >
API - ESBuild
This API call is used by the command-line interface if no input files are ... If needed, the working directory that esbuild uses...
Read more >
Working with Environment Variables in Node.js - Twilio
Environment variables are a great way to configure parts of your Node.js application. Learn how to work with them using helpful tools such ......
Read more >
How to resolve 'node' is not recognized as an internal or ...
Open the Environment Variables option in your Control Panel. · Select the variable named Path. · Restart the command prompt again and now...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found