Home > Net >  Can I run an npm package without the npm run command?
Can I run an npm package without the npm run command?

Time:05-17

I would like to run the next.js build process directly from the command line without going over the package.json. Is it possible to run it without npm run?

Instead of running npm run build

I would like to run next build directly on the command line.

Cheers for the help.

CodePudding user response:

why not just use npm run build directly? if you want to do it, you may need config your environment which needs global environment variable in your system. take angular for example, you need install ng -g to use ng directly

CodePudding user response:

you can go to package.json and then change the scripts.

"build": "next build",

CodePudding user response:

I figured it out so basically whatever you add at the end of the npm run command gets attached to the npm run command:

"scripts": {
    "dev": "next dev",
    "build": "next build",
    "export": "next build && next export -o",
  }

Now I can run

npm export jane-doe-directory

And the application will be exported to that directory.

  • Related