'Can I run an npm package without the npm run command?
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.
Solution 1:[1]
If you look inside your project's node_modules/.bin directory, you should see an alias for the next command. So if you want to run next build directly without using npm...
Bash:
./node_modules/.bin/next build
Windows Command Prompt:
.\node_modules\.bin\next.cmd build
Solution 2:[2]
you can go to package.json and then change the scripts.
"build": "next build",
Solution 3:[3]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mark G |
| Solution 2 | Owali Ullah Shawon |
| Solution 3 | brame |
