0

I follow this post to configure NextJs to use absolute paths, like this:

//package.json:
...
"scripts": {
  "dev": "NODE_PATH=. next",
  "build": "NODE_PATH=. next build",
  "start": "next start"
 },

NodeJs, npm and nextJs app are up to date both on windows and Linux.

It works on Linux, but when i try to build on a Windows, it fails with the error

'NODE_PATH' is not recognized as an internal or external command, operable program or batch file.

Update

I find out that npm is just running SO scripts, so in windows, the equivalent for:

NODE_PATH=. next

wold be:

set NODE_PATH=. & next

But doesn't work because the command set does not affect the context of the second command

set X=1 & echo %X% returns
%X% //for first run. doesn't consider it a variable because doesn't know her
1 //for second run

Can't figure out how to overcame this last problem

MiguelSlv
  • 14,067
  • 15
  • 102
  • 169

1 Answers1

0

works from outside:

>set NODE_PATH=.
>npm run dev

Should be some better solution somewhere

MiguelSlv
  • 14,067
  • 15
  • 102
  • 169