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

package.json scripts with nodemon do not find ts-node. #2340

Closed
jlguenego opened this issue Dec 13, 2020 · 1 comment
Closed

package.json scripts with nodemon do not find ts-node. #2340

jlguenego opened this issue Dec 13, 2020 · 1 comment
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@jlguenego
Copy link

jlguenego commented Dec 13, 2020

Note on possible duplicata: I have searched without success an existing issue with nodemon and ts-node, but not found.

Current Behavior:

Scripts declared in package.json under the scripts section do not behave as previous npm version (<7).
Example with nodemon, and ts-node (typescript):

{
  "name": "",
  "version": "0.0.0",
  "description": "",
  "main": "build/src/index.js",
  "types": "build/src/index.d.ts",
  "files": [
    "build/src"
  ],
  "license": "Apache-2.0",
  "keywords": [],
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "lint": "gts lint",
    "clean": "gts clean",
    "compile": "tsc",
    "fix": "gts fix",
    "prepare": "npm.cmd run compile",
    "pretest": "npm.cmd run compile",
    "posttest": "npm.cmd run lint",
    "start": "nodemon src/index.ts"
  },
  "devDependencies": {
    "@types/node": "^14.11.2",
    "gts": "^3.0.3",
    "typescript": "^4.0.3",
    "nodemon": "^2.0.6",
    "ts-node": "^9.1.1"
  }
}

D:\formation\jlg-test>npm start

> start
> nodemon src/index.ts

[nodemon] 2.0.6
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: ts,json
[nodemon] starting `ts-node src/index.ts`
'ts-node' is not recognized as an internal or external command,
operable program or batch file.
[nodemon] app crashed - waiting for file changes before starting...

Expected Behavior:

As with the previous npm version,

> start
> nodemon src/index.ts

[nodemon] 2.0.6
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: ts,json
[nodemon] starting `ts-node src\index.ts`
Try npm run lint/fix!
[nodemon] clean exit - waiting for changes before restart

Steps To Reproduce:

mkdir jlg-test
cd jlg-test
npx gts init
npm i -D nodemon
npm i -D ts-node

add inside the package.json the start scripts:

"start": "nodemon src/index.ts"

Environment:

OS: Windows 10
Node v15.4.0
npm 7.0.15

@jlguenego jlguenego added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Dec 13, 2020
@darcyclarke
Copy link
Contributor

@jlguenego appreciate you filing this; That said, I'm not sure what we can do here as this seems like it would be an issue with nodemon; I'd also not that we've made several improvements/fixes to v7 since you first reported this & I'd encourage you to try out the latest release to see if it's resolved any problems (ie. npm i -g npm@7). If you're still experiencing issues, I'd file a bug with nodemon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

2 participants