Nest: Not able to start new project in pure javascript

Created on 28 May 2020  ·  4Comments  ·  Source: nestjs/nest

Bug Report

Current behavior

So neither using nest-cli with paramater language nor cloning the javascript starter template works without errors.

Using the standard nest new foobar works, so probably no general problem with my environment.

Nest-cli

Side note: The usage information differs between the online docs and the --help section.

Usage according to cli help

$ nest new --help
Usage: nest new|n [options] [name]
$ nest new --language="JS" myapp2
⚡  We will scaffold your app in a few seconds..

Nothing to be done.

? Which package manager would you ❤️  to use? npm
▹▹▹▹▹ Installation in progress... ☕events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn /bin/sh ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn /bin/sh',
  path: '/bin/sh',
  spawnargs: [ '-c', 'npm install --silent' ]
}



md5-760445fc601730ebe7210f69b576346e



$ nest new <name> [options]



md5-2c48fc0d97eecc2d5b58b28850e4d9cf



$ nest new myapp --language="JS"
⚡  We will scaffold your app in a few seconds..

Nothing to be done.

? Which package manager would you ❤️  to use? npm
▹▹▹▹▹ Installation in progress... ☕events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn /bin/sh ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn /bin/sh',
  path: '/bin/sh',
  spawnargs: [ '-c', 'npm install --silent' ]
}



md5-1fbde57ed969a38fbc4941295283563f



$ git clone https://github.com/nestjs/javascript-starter.git project
$ cd project
$ npm install
[...] npm installations without errors
$ npm run start

> [email protected] start /mypath/project
> babel-node index.js

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

Error: Cannot find module '@babel/compat-data/corejs3-shipped-proposals'
Require stack:
- /mypath/project/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js
- /mypath/project/node_modules/@babel/preset-env/lib/index.js
- /mypath/project/node_modules/@babel/core/lib/config/files/plugins.js
- /mypath/project/node_modules/@babel/core/lib/config/files/index.js
- /mypath/project/node_modules/@babel/core/lib/index.js
- /mypath/project/node_modules/@babel/node/lib/_babel-node.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/mypath/project/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js:10:55)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/mypath/project/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Object.newLoader [as .js] (/mypath/project/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:986:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/mypath/project/node_modules/@babel/preset-env/lib/polyfills/corejs3/usage-plugin.js',
    '/mypath/project/node_modules/@babel/preset-env/lib/index.js',
    '/mypath/project/node_modules/@babel/core/lib/config/files/plugins.js',
    '/mypath/project/node_modules/@babel/core/lib/config/files/index.js',
    '/mypath/project/node_modules/@babel/core/lib/index.js',
    '/mypath/project/node_modules/@babel/node/lib/_babel-node.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `babel-node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start 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!     /home/myname/.npm/_logs/2020-05-28T08_27_09_136Z-debug.log

Expected behavior

Generating a non typescript based project should be possible.

Environment


Nest version: 7.2.0

For Tooling issues:
- Node version: v12.17.0
- Platform:  Linux Mint 19.3
needs triage

Most helpful comment

I can confirm on Mac OS with @nestjs/cli v 7.2.0 that nest n -l js -p yarn is working as intended

All 4 comments

Have you tried $ nest n -l js?

I can confirm on Mac OS with @nestjs/cli v 7.2.0 that nest n -l js -p yarn is working as intended

I am having this same issue while using the project from javascript starter from github. Same issue described above

Try using nest n -l js (instead of javascript). Also in an upcoming minor CLI release, both javascript and js will work as well to fix the bug in general :) @vipul-vinsol

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KamGor picture KamGor  ·  3Comments

VRspace4 picture VRspace4  ·  3Comments

marshall007 picture marshall007  ·  3Comments

breitsmiley picture breitsmiley  ·  3Comments

tronginc picture tronginc  ·  3Comments