microsoft / TypeScript-Node-Starter

A reference example for TypeScript and Node with a detailed README describing how to use the two together.
MIT License
11.31k stars 2.77k forks source link

App Service: "Application Error" - Cannot find module '../lib/utils/unsupported.js' #193

Open simkessy opened 5 years ago

simkessy commented 5 years ago

I've tried to follow these steps but the application is now saying "Application Error"

I looked at the logs and I see this:

Debugger listening on ws://0.0.0.0:49494/703f9862-c7bf-4f73-8803-e3de51b27f78
For help see https://nodejs.org/en/docs/inspector
module.js:549
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at /home/site/wwwroot/node_modules/.bin/npm:19:21
    at Object.<anonymous> (/home/site/wwwroot/node_modules/.bin/npm:152:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app@1.0.0 start: `npm run serve`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the app@1.0.0 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!     /root/.npm/_logs/2019-06-10T03_44_47_900Z-debug.log

I've deployed using Node LTS 10, 8 and 6.

I'm using DevOps to deploy:

image

Pipelines: Agent Pool Ubuntu 1604 Get Sources: Azure Repos npm i npm@latest npm i -g typescript ts-lint npm i npm run build

image

Package.js scripts:

  "scripts": {
    "start": "npm run serve",
    "serve": "node dist/index.js",
    "prebuild": "tslint -c tslint.json -p tsconfig.json --fix 'src/**/*'",
    "build": "tsc",
    "dev": "nodemon --exec ts-node src\\index.ts",
    "d": "nodemon -r esm src\\index.ts",
    "check-types": "tsc",
    "test": "echo \"Error: no test specified\" && exit 1"
  },

App Service Files:

image

I googled the NPM Error and all the suggestions I found has to do with deleting Node but I'm assuming every time I push a build a new node_modules is installed so I'm not sure where to go from there.

EDIT:

So I just tried deploying it through the VS Code extension and it worked without problem. Which is great. However, I'd really like for this to working through Pipelines using DevOps so I can setup a CI/CD process. Any ideas why it might be failed through pipelines?

peterblazejewicz commented 5 years ago

Can you switch to the 10? (the latest version should work OK with the 10 TLS release). We are using Node 10 with Azure DevOps at work for very different task and yet it never failed.