Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when building new app #383

Open
LukeP1 opened this issue Nov 25, 2019 · 20 comments
Open

Error when building new app #383

LukeP1 opened this issue Nov 25, 2019 · 20 comments

Comments

@LukeP1
Copy link

LukeP1 commented Nov 25, 2019

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`

@felek000
Copy link

I have same problem when running on docker.

@kleyton885
Copy link

error while trying to install nuxt on ubuntu 16.04
command: npx create-nuxt-app

module.js:328
throw err;
^

Error: Cannot find module '/root/.npm/_npx/11123/lib/node_modules/create-nuxt-app/node_modules/ejs/postinstall.js'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966: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/2019-12-18T13_12_33_407Z-debug.log
Install for create-nuxt-app@latest failed with code 1

@maxiride
Copy link

maxiride commented Dec 27, 2019

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.

@cmaneu
Copy link

cmaneu commented Jan 14, 2020

Same issue here:

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

@ankitarora05
Copy link

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

@JenCant
Copy link

JenCant commented Apr 13, 2020

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.

@ghost
Copy link

ghost commented Apr 30, 2020

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.

@Soviut
Copy link

Soviut commented May 31, 2020

Tried node 14, 14-alpine, 12, 12-alpine and all yielded the same error.

I had to shell into a node container, install globally and then npm init.

MSYS_NO_PATHCONV=1 docker run --rm -it -v `pwd`:/usr/src -w /usr/src node:12 sh

$ npm install -g create-nuxt-app
$ npm init nuxt-app .

The MSYS_NO_PATHCONV=1 is to make sure the pwd maps the volume correctly correctly in git-bash.

@clarkdo
Copy link
Member

clarkdo commented Jun 2, 2020

@LukeP1 From the log, the error seems from ejs and there is an issue there as well mde/ejs#487 , I think we can open an issue there and figure out a fix.

@akirarika
Copy link

+1

@janiskemper
Copy link

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

@devlim
Copy link

devlim commented Sep 13, 2020

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.

@hibriiiiidge
Copy link

hibriiiiidge commented Oct 3, 2020

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

@GlitchMasta47
Copy link

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.

@kennyalmendral
Copy link

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

@juliuskrah
Copy link

+1

@amjltc295
Copy link

...
> core-js@2.6.12 postinstall /root/frontend/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@3.9.1 postinstall /root/frontend/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js-pure@3.9.1 postinstall /root/frontend/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"


> ejs@2.7.4 postinstall /root/frontend/node_modules/ejs
> node ./postinstall.js

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

Error: Cannot find module '/root/frontend/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 WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.3 (node_modules/react-scripts/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN react-debounce-input@3.2.3 requires a peer of react@^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-inspector@2.3.1 requires a peer of react@^0.14.0 || ^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-motion@0.5.2 requires a peer of react@^0.14.9 || ^15.3.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-redux@4.4.10 requires a peer of react@^0.14.0 || ^15.0.0-0 || ^15.4.0-0 || ^16.0.0-0 but none is installed. You must install peer dependencies yourself.

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/2021-03-12T08_23_00_578Z-debug.log

FYI, I encountered a similar error while installing react-scripts (npm install with a package.json having dependency of react-scripts.)
I could reproduce this in a container with /root as home directory.
For some reason, when the folder is put under /root (home) this error occurs. However, when I move it to other folder (e.g. /opt) it does not happen.

$ node -v
v12.18.2
$ npm -v
6.14.5

@clarkdo
Copy link
Member

clarkdo commented Mar 16, 2021

@amjltc295 From the error log, it seems missing ejs postinstall file from you node_module, can you double check if /root/frontend/node_modules/ejs/postinstall.js exists and has executable permission ?

@jcredi26
Copy link

docker run -v "$PWD":/usr/src/app -w /usr/src/app --rm -it node:14-alpine sh -c 'npm i -g create-nuxt-app && npm init nuxt-app frontend'

@mahmudunnabikajal
Copy link

Download latest nodejs .exe (recommended for most users) from https://nodejs.org/en and install. it will replace your previous version

Check Version:

  • node -v
  • npm -v

Nuxt 2 Require:

  • Node.js - 16.x or 14.x
  • npm v5.2+ or v6.1+

Nuxt 3 Require:

  • Node.js - v16.10.0 or newer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests