NPM Missing Generate Script
See original GitHub issueVersion
Reproduction link
https://github.com/ngblaylock/nuxt-sandbox/tree/npm-missing-generate-script
Steps to reproduce
When I do a standard npx create-nuxt-app project
, my project is set up just fine. I use NPM instead of Yarn. Then, as per the README.md file, I run npm run generate
where I get an error.
I can get it to work if I manually put in “generate”: “nuxt generate” in the package.json file, it works, but it is not there by default.
What is expected ?
I expect Nuxt to generate static files into a dist
directory.
What is actually happening?
When I go to generate the static files, I get npm ERR! missing script: generate
.
Additional comments?
I was going to submit this through codesandbox.com, but I believe since they use Yarn, it works out of the box.
<div align="right">This bug report is available on Nuxt community (#c10849)</div>Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top Results From Across the Web
npm ERR! Missing script: "build" [Solved] | bobbyhadz
To solve the npm ERR! Missing script: "build" error, make sure to add a build command to the scripts object in your package.json...
Read more >Using "npm run build" fails with "npm ERR! missing script: build"
First check you have .babelrc file in your root folder. if you already have. Add this in your package.json file "scripts": { "dev":...
Read more >Missing script generate · Issue #480 - GitHub
I have got to the point where my traits are ready and named. when I run: npm run generate or npm generate I...
Read more >What does it mean when you get the NPM error missing script
It means in your “package.json” (in the folder in which you run “npm run build”), there's NO “build” script. A quick check: run...
Read more >[Solved] npm err! missing script: start - ItsJavaScript
How to fix npm err! missing script: start · Solution 1 – Add the Start Scripts in package.json · Solution 2 – Ensure...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That makes sense. Then I would still suggest a change on the default
README.md
to say something along the lines of:When I follow the instructions to generate a static project in the
README.md
file, it threw an error sincenpm run generate
didn’t exist. I think new developers could get easily confused by that.I also noticed that I needed to run
nuxt build --target static
if I didn’t configurenuxt.config.js
.Something to consider that I think works pretty good is to add
to my
package.json
scripts
section. Then runnpm run static
. Is that a logical script? That considerations is probably better for future readers than for official Nuxt documentation.Hi @ngblaylock. Actually this change is to encourage using new
nuxt export
(npm run export
) command for static target. You can still add"generate": "nuxt generate"
topackage.json
scripts
section for legacy generate.Docs should be already updated to mention using
export
(instead ofgenerate
).