FoalTS / foal

Full-featured Node.js framework, with no complexity. 🚀 Simple and easy to use, TypeScript-based and well-documented.
https://foalts.org/
MIT License
1.88k stars 137 forks source link

npm run develop throws errors #377

Closed rick-software closed 5 years ago

rick-software commented 5 years ago

npm run develop

foalts@0.0.0 develop /Users/rick/Documents/projects/foalts npm run build:app && concurrently "npm run build:app:w" "npm run start:w"

foalts@0.0.0 build:app /Users/rick/Documents/projects/foalts copy-cli "src/*/.html" build && tsc -p tsconfig.app.json

node_modules/typeorm/connection/Connection.d.ts:40:28 - error TS1039: Initializers are not allowed in ambient contexts.

40 readonly isConnected = false;



npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! foalts@0.0.0 build:app: `copy-cli "src/**/*.html" build && tsc -p tsconfig.app.json`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the foalts@0.0.0 build:app 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!     /Users/rick/.npm/_logs/2019-03-14T03_01_37_204Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! foalts@0.0.0 develop: `npm run build:app && concurrently "npm run build:app:w" "npm run start:w"`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the foalts@0.0.0 develop 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!     /Users/rick/.npm/_logs/2019-03-14T03_01_37_221Z-debug.log

...and in the log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'develop' ]
2 info using npm@6.4.1
3 info using node@v10.15.0
4 verbose run-script [ 'predevelop', 'develop', 'postdevelop' ]
5 info lifecycle foalts@0.0.0~predevelop: foalts@0.0.0
6 info lifecycle foalts@0.0.0~develop: foalts@0.0.0
7 verbose lifecycle foalts@0.0.0~develop: unsafe-perm in lifecycle true
8 verbose lifecycle foalts@0.0.0~develop: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/rick/Documents/projects/foalts/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle foalts@0.0.0~develop: CWD: /Users/rick/Documents/projects/foalts
10 silly lifecycle foalts@0.0.0~develop: Args: [ '-c',
10 silly lifecycle   'npm run build:app && concurrently "npm run build:app:w" "npm run start:w"' ]
11 silly lifecycle foalts@0.0.0~develop: Returned: code: 2  signal: null
12 info lifecycle foalts@0.0.0~develop: Failed to exec develop script
13 verbose stack Error: foalts@0.0.0 develop: `npm run build:app && concurrently "npm run build:app:w" "npm run start:w"`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid foalts@0.0.0
15 verbose cwd /Users/rick/Documents/projects/foalts
16 verbose Darwin 18.2.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "develop"
18 verbose node v10.15.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error foalts@0.0.0 develop: `npm run build:app && concurrently "npm run build:app:w" "npm run start:w"`
22 error Exit status 2
23 error Failed at the foalts@0.0.0 develop script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

...but 
npm start
brings the ui up - not sure about those errors
rick-software commented 5 years ago

MacOS Mojave $node -v v10.15.0 $ npm -v 6.4.1

LoicPoullain commented 5 years ago

Hi Rick,

Thank you for reporting this issue!

I got the same problem when creating a new project. It looks like it is related to a new version of TypeORM (v0.2.15) published 14 hours ago. I'm still investigating to understand what happens.

Running npm install typeorm@0.2.14 fixes the problem.

...but npm start brings the ui up - not sure about those errors

The TypeScript compiler can compile files even if they are type errors sometimes. That's why it's working with npm start which just executes the JS compiled files.

LoicPoullain commented 5 years ago

The new version of TypeORM requires TypeScript 3, that's why the command was failing as the CLI installs TypeScript 2.9.2.

I published a new version of the CLI installing TypeScript 3 by default (the framework supports both TS2 and TS3). This should fix the issue.

# To upgrade
npm install -g @foal/cli

Can you confirm that it's working properly?

cr4ftx commented 5 years ago

It solves the problem for me ty.