create-nuxt-app: Error when building new app

I am getting this error when trying to create a new nuxt app

node -v v12.13.1

` npx create-nuxt-app ui-dev2 internal/modules/cjs/loader.js:800 throw err; ^

Error: Cannot find module ‘/root/.npm/_npx/26147/lib/node_modules/create-nuxt-app/node_modules/ejs/postinstall.js’ at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15) at Function.Module._load (internal/modules/cjs/loader.js:690:27) at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) at internal/main/run_main_module.js:17:11 { code: ‘MODULE_NOT_FOUND’, requireStack: [] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! ejs@2.7.4 postinstall: node ./postinstall.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the ejs@2.7.4 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-11-25T20_35_42_769Z-debug.log Install for [ ‘create-nuxt-app@latest’ ] failed with code 1`

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 8
  • Comments: 20 (2 by maintainers)

Most upvoted comments

https://gamecom.app/

I created a website on nuxt and have a infinite loader on the feed on the landing. Gives me great performance using vue and server render. Any thoughts?

FYI you have to login to enjoy the feed :-p

Same error:

// in docker container running node:latest
root@6d8e7e7ba219:/home/node/app# node -v && npm -v
v13.5.0
6.13.4

// in host shell
C:\Users\maxir>docker -v
Docker version 19.03.5, build 633a0ea

Edit Running npm i -g create-nuxt-app solved it for me. I have been able to run npm init nuxt-app . flawlessly.

Same issue here:

  • Using from a docker container (VS Code Remote Extensions)
  • running npm i -g create-nuxt-app solved it.

I got the same error. I used Node.js version 14.x, then switched to Node.js version 12.x and the problem was fixed.

npm i -g create-nuxt-app solved the issue

I was encountering the same issue just a little while ago, but I seem to have fixed it by using a different non-root account. I’m not sure why but it worked for me.

I have same problem. I resolved the problem, install ejs@3.0.1 before $ npm init nuxt-app . or $ npx create-nuxt-app

# in Node.js container
$ npm install -g ejs@3.0.1 

versions

# in Node.js container
root@204c32b15683:/app# node -v
v14.3.0
root@204c32b15683:/app# npm -v
6.14.4
root@204c32b15683:/app# nuxt -v
2.0.0
root@204c32b15683:/app# create-nuxt-app -v
create-nuxt-app/2.15.0 linux-x64 node-v14.3.0

i encounter same issue.

It’s seem that Docker daemon always runs as the root user, we not allow to use root user to run npx command.

I got the same error using Node v12.18.0. Then I tried npm i -g create-nuxt-app, leading to the error

/root/.nvm/versions/node/v12.18.0/bin/create-nuxt-app -> /root/.nvm/versions/node/v12.18.0/lib/node_modules/create-nuxt-app/lib/cli.js

> ejs@2.7.4 postinstall /root/.nvm/versions/node/v12.18.0/lib/node_modules/create-nuxt-app/node_modules/ejs
> node ./postinstall.js

internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '/root/.nvm/versions/node/v12.18.0/lib/node_modules/create-nuxt-app/node_modules/ejs/postinstall.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ejs@2.7.4 postinstall: `node ./postinstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ejs@2.7.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-07-20T07_41_09_161Z-debug.log

Getting this error on a new app install, debian 10:

npx create-nuxt-app
internal/modules/cjs/loader.js:638
    throw err;
    ^
Error: Cannot find module '/root/.npm/_npx/2723/lib/node_modules/create-nuxt-app/node_modules/ejs/postinstall.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ejs@2.7.4 postinstall: `node ./postinstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ejs@2.7.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-04-13T09_48_42_308Z-debug.log
Install for create-nuxt-app@latest failed with code 1

Fixed it with @cmaneu answer npm i -g create-nuxt-app and then ran the npx create-nuxt-app command again.

I have same problem when running on docker.