Asked  6 Months ago    Answers:  5   Viewed   2.5k times

When I try to start my app on Heroku I got the following stack trace. It is just a basic ts.app like you see with ts-node and nodemon. If you need any more Infos just tell me that because it's my first post. I am really interested in what the answer is going to be.

2020-05-30T00:03:12.201106+00:00 heroku[web.1]: Starting process with command `npm start`
2020-05-30T00:03:14.405285+00:00 app[web.1]: 
2020-05-30T00:03:14.405303+00:00 app[web.1]: > discordtoornamentmanager@1.0.0 start /app
2020-05-30T00:03:14.405303+00:00 app[web.1]: > ts-node src/App.ts
2020-05-30T00:03:14.405304+00:00 app[web.1]: 
2020-05-30T00:03:14.833655+00:00 app[web.1]: (node:23) ExperimentalWarning: The ESM module loader is experimental.
2020-05-30T00:03:14.839311+00:00 app[web.1]: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for /app/src/App.ts
2020-05-30T00:03:14.839312+00:00 app[web.1]:     at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:65:15)
2020-05-30T00:03:14.839314+00:00 app[web.1]:     at Loader.getFormat (internal/modules/esm/loader.js:113:42)
2020-05-30T00:03:14.839315+00:00 app[web.1]:     at Loader.getModuleJob (internal/modules/esm/loader.js:244:31)
2020-05-30T00:03:14.839315+00:00 app[web.1]:     at processTicksAndRejections (internal/process/task_queues.js:97:5)
2020-05-30T00:03:14.839316+00:00 app[web.1]:     at Loader.import (internal/modules/esm/loader.js:178:17)
2020-05-30T00:03:14.847801+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2020-05-30T00:03:14.847998+00:00 app[web.1]: npm ERR! errno 1
2020-05-30T00:03:14.848957+00:00 app[web.1]: npm ERR! discordtoornamentmanager@1.0.0 start: `ts-node src/App.ts`
2020-05-30T00:03:14.849050+00:00 app[web.1]: npm ERR! Exit status 1
2020-05-30T00:03:14.849172+00:00 app[web.1]: npm ERR! 
2020-05-30T00:03:14.849254+00:00 app[web.1]: npm ERR! Failed at the discordtoornamentmanager@1.0.0 start script.
2020-05-30T00:03:14.849337+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-05-30T00:03:14.854859+00:00 app[web.1]: 
2020-05-30T00:03:14.854998+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2020-05-30T00:03:14.855069+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2020-05-30T00_03_14_850Z-debug.log
2020-05-30T00:03:14.907689+00:00 heroku[web.1]: Process exited with status 1
2020-05-30T00:03:14.943718+00:00 heroku[web.1]: State changed from starting to crashed

This is my package.json

{
   "name": "discordtoornamentmanager",
   "version": "1.0.0",
   "description": "",
   "main": "dist/app.js",
   "type": "module",
   "scripts": {
      "test": "echo "Error: no test specified" && exit 1",
      "dev": "nodemon -x ts-node src/App.ts",
      "start": "ts-node src/App.ts"
   },
   "keywords": [],
   "author": "",
   "license": "ISC",
   "dependencies": {
      "@types/node": "^14.0.5",
      "axios": "^0.19.2",
      "discord.js": "^12.2.0",
      "pg": "^8.2.1",
      "reflect-metadata": "^0.1.10",
      "typeorm": "0.2.25",
      "typescript": "^3.9.3",
      "nodemon": "^2.0.4",
      "ts-node": "8.10.1"

   }
}

And this is my tsconfig

{
   "compilerOptions": {
      "lib": [
         "es6"
      ],
      "target": "es6",
      "module": "commonjs",
      "moduleResolution": "node",
      "outDir": "dist",
      "resolveJsonModule": true,
      "emitDecoratorMetadata": true,
      "esModuleInterop": true,
      "experimentalDecorators": true,
      "sourceMap": true
   },
   "include": ["src/**/*.ts"],
   "exclude": ["node_modules", "**/*.spec.ts"]
}

 Answers

83

Remove "type": "module" from package.json


https://github.com/TypeStrong/ts-node/issues/935

Thursday, June 24, 2021
 
twk
answered 6 Months ago
twk
28

".ser" is a reasonable choice for the file suffix - http://www.file-extensions.org/ser-file-extension

However, you could argue that it make little difference what suffix you use ... provided that is doesn't clash other commonly used application suffixes.

A Java serialized object file can only be read (in the normal way) by a Java application that has the relevant classes on its classpath. A one-size-fits-all ".ser" suffix provides no clues as to what those classes might be and where an application launch framework should find them. So you won't be able to set up a Windows-style file association to provide double-click application launching.


Is there a way i can view or edit a ".ser" file ??

Possibly, but with great difficulty, and only under certain conditions.

The contents the file will be highly dependent on the class that was serialized. Now it is possible to determine the name of that class, and (in some cases) the names and types of the serialized fields. However if the class uses custom serialization / externalization, the representation will be an opaque blob of binary data with no clues in the file as to how to decode it. The opaque blob problem is fairly common because many important classes in the Java SE class library use custom serialization ... for efficiency ... and so do many application classes.

The other possible approach is to find the .class files for all of the classes mentioned in the .ser file, deserialize to objects, and use reflection to access the fields of the deserialised objects. You could even tweak them and reserialize them. However, if you don't have the right versions of all of the .class files, this is a non-starter.

Finally, editing a ".ser" file using a binary editor is technically possible, but would be dangerous. The serialization format is not designed to support this.

Monday, August 2, 2021
 
Oshrib
answered 4 Months ago
41

You should be able to remove the npm directory (typically /usr/local/lib/node_modules/npm) and then reinstall one of the official node tarballs, which includes npm (you can find the latest from http://nodejs.org/dist/latest-v7.x/).

Did you upgrade from an older version of node?

If so, that is probably part of the reason why you are having this issue. Older versions of graceful-fs (a dependency of npm) did things that are no longer available in node v7.

Monday, August 16, 2021
 
lupz
answered 4 Months ago
89

From http://blog.goneopen.com/2009/06/git-excludes-for-dotnet/:

.DS_Store
._*
TestResults
*Resharper*
**.ReSharper**
**_ReSharper.**
*.bak
*.cache
*.resharperoptions
*.suo
*.user
*.vsprops
*/TestResults
*bin*
*obj*
_ReSharper.*
Wednesday, October 20, 2021
 
Luciano Selzer
answered 2 Months ago
43

Running this code have solved my problem on ubuntu 16.04

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Sunday, November 7, 2021
 
Agustín
answered 4 Weeks ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share