Closed ghost closed 8 years ago
Looks like this issue https://github.com/mgechev/angular2-seed/issues/132.
We'll have a look.
@mgechev , I fixed it by compiling the .ts files to .js
tsc tools/tasks/*.ts gulpfile.ts
Now it works
@ravi-tj yeah, this works, however, it is more than a workaround rather than a real solution.
There's an issue with the ts-node module, which doesn't run the build gulpfile itself.
FYI: npm WARN deprecated typescript-node@0.1.3: typescript-node has been renamed to ts-node
Maybe we don't need that one.
This issue is fixed by https://github.com/mgechev/angular2-seed/pull/155
Hi @mgechev
I cloned the repo, executed npm install
and still have this problem.
What should I do to resolve it?
@tommyJS could you tell what error you get?
npm start
> angular2-seed@0.0.0 start /home/tommyjs/Desktop/angular2-hot-loader
> gulp serve --env dev
[19:54:56] Requiring external module ts-node/register
----------------------------------
⨯ Unable to compile TypeScript
gulpfile.ts (1,23): Cannot find module 'gulp'. (2307)
----------------------------------
npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.2.0
npm ERR! npm v3.3.6
npm ERR! code ELIFECYCLE
npm ERR! angular2-seed@0.0.0 start: `gulp serve --env dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular2-seed@0.0.0 start script 'gulp serve --env dev'.
npm ERR! This is most likely a problem with the angular2-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp serve --env dev
npm ERR! You can get their info via:
npm ERR! npm owner ls angular2-seed
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/tommyjs/Desktop/angular2-hot-loader/npm-debug.log
tommyjs-VPCEB2S1E angular2-hot-loader # npm start
> angular2-seed@0.0.0 start /home/tommyjs/Desktop/angular2-hot-loader
> gulp serve --env dev
[20:17:28] Requiring external module ts-node/register
----------------------------------
⨯ Unable to compile TypeScript
gulpfile.ts (1,23): Cannot find module 'gulp'. (2307)
----------------------------------
npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.2.0
npm ERR! npm v3.3.6
npm ERR! code ELIFECYCLE
npm ERR! angular2-seed@0.0.0 start: `gulp serve --env dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular2-seed@0.0.0 start script 'gulp serve --env dev'.
npm ERR! This is most likely a problem with the angular2-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp serve --env dev
npm ERR! You can get their info via:
npm ERR! npm owner ls angular2-seed
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/tommyjs/Desktop/angular2-hot-loader/npm-debug.log
In advance, thank you for your help.
and npm install
didn't give any errors?
I don't see any errors.
However, the info from npm install
is so long that I cannot analyze it from the beginning. Do you know how to log this output to a file?
Npm install > log.txt Something like that?
On 31 Oct 2015, at 15:25, Tomasz Adrianowski notifications@github.com wrote:
I don't see any errors.
However, the info from npm install is so long that I cannot analyze it from the beginning. Do you know how to log this output to a file?
— Reply to this email directly or view it on GitHub.
Thank you.
There are no errors during npm install
.
Unfortunately, I cannot upload here .txt files.
Do you have other ideas?
I am getting this issues too. after a successful npm install. I have compiled typescript before for another project so not sure why its not working on this one. I'm using Ubuntu 15, Node v5.2.0 and Npm v3.5.2
> angular2-seed@0.0.0 start /home/al/Projects/Video Dash/seed-test/angular2-seed
> gulp serve --env dev
[08:16:34] Requiring external module ts-node/register
----------------------------------
⨯ Unable to compile TypeScript
gulpfile.ts (1,23): Cannot find module 'gulp'. (2307)
tools/config.ts (1,28): Cannot find module 'fs'. (2307)
tools/config.ts (58,25): Cannot find name 'require'. (2304)
tools/typings/merge-stream.d.ts (2,36): Cannot find namespace 'NodeJS'. (2503)
tools/typings/merge-stream.d.ts (3,33): Cannot find namespace 'NodeJS'. (2503)
tools/typings/merge-stream.d.ts (4,17): Cannot find namespace 'NodeJS'. (2503)
tools/typings/systemjs-builder.d.ts (4,60): Cannot find name 'Promise'. (2304)
tools/typings/systemjs-builder.d.ts (5,65): Cannot find name 'Promise'. (2304)
tools/utils.ts (9,17): Cannot find name 'require'. (2304)
tools/utils/server.ts (2,26): Cannot find module 'express'. (2307)
tools/utils/server.ts (5,30): Cannot find module 'serve-static'. (2307)
tools/utils/server.ts (6,23): Cannot find module 'path'. (2307)
tools/utils/server.ts (19,20): Cannot find name 'process'. (2304)
tools/utils/server.ts (39,25): Cannot find name 'process'. (2304)
tools/utils/tasks_tools.ts (1,23): Cannot find module 'gulp'. (2307)
tools/utils/tasks_tools.ts (2,23): Cannot find module 'gulp-util'. (2307)
tools/utils/tasks_tools.ts (3,24): Cannot find module 'chalk'. (2307)
tools/utils/tasks_tools.ts (5,50): Cannot find module 'fs'. (2307)
tools/utils/tasks_tools.ts (6,20): Cannot find module 'path'. (2307)
tools/utils/tasks_tools.ts (17,10): Cannot find name 'require'. (2304)
tools/utils/template-injectables.ts (2,20): Cannot find module 'path'. (2307)
It can happen that after the npm install
and you're getting this kind of error that you have to manually run npm run tsd -- install
. This does not happen all the time for me but sometimes only.
Not sure why it's closed, it's still an issue. If there are global dependencies - please list them.
Same here at a developer of my team
@gustavolira do you have ts-node installed globally?
Yes I have, now is occurring with another developers. If I do npm start ou npm run build.dev I receive:
⨯ Unable to compile TypeScript
gulpfile.ts (1,23): Cannot find module 'gulp'. (2307) tools/config.ts (1,28): Cannot find module 'fs'. (2307) tools/config.ts (2,20): Cannot find module 'yargs'. (2307) tools/config.ts (3,31): Cannot find module 'path'. (2307) tools/config.ts (14,52): Cannot find name '__dirname'. (2304) tools/config.ts (165,50): Cannot find name 'require'. (2304) tools/manual_typings/merge-stream.d.ts (2,36): Cannot find namespace 'NodeJS'. (2503) tools/manual_typings/merge-stream.d.ts (3,33): Cannot find namespace 'NodeJS'. (2503) tools/manual_typings/merge-stream.d.ts (4,17): Cannot find namespace 'NodeJS'. (2503) tools/utils.ts (9,17): Cannot find name 'require'. (2304) tools/utils/code_change_tools.ts (2,20): Cannot find module 'path'. (2307) tools/utils/code_change_tools.ts (4,30): Cannot find module 'browser-sync'. (2307) tools/utils/server.ts (1,26): Cannot find module 'express'. (2307) tools/utils/server.ts (3,30): Cannot find module 'serve-static'. (2307) tools/utils/server.ts (5,23): Cannot find module 'path'. (2307) tools/utils/server.ts (22,25): Cannot find name 'process'. (2304) tools/utils/tasks_tools.ts (1,23): Cannot find module 'gulp'. (2307) tools/utils/tasks_tools.ts (2,23): Cannot find module 'gulp-util'. (2307) tools/utils/tasks_tools.ts (3,24): Cannot find module 'chalk'. (2307) tools/utils/tasks_tools.ts (4,34): Cannot find module 'gulp-load-plugins'. (2307) tools/utils/tasks_tools.ts (5,31): Cannot find module 'run-sequence'. (2307) tools/utils/tasks_tools.ts (6,50): Cannot find module 'fs'. (2307) tools/utils/tasks_tools.ts (7,20): Cannot find module 'path'. (2307) tools/utils/tasks_tools.ts (19,10): Cannot find name 'require'. (2304) tools/utils/template_injectables.ts (4,20): Cannot find module 'path'. (2307)
npm install -g ts-node
should be without sudo
.typings
.I'm running at a dev server there's only root user npm install -g ts-node
was installed with root user.
My typings.json is:
root@ubuntu-4gb-nyc3-01:~/angular2-seed# cat typings.json { "dependencies": { "es6-promise": "github:typings/typed-es6-promise#9243c53f70fb4909ed7cce3094bec221b9fb6d5f", "xhr2": "github:gdi2290/typed-xhr2#69f2b8d40d0cd407c1b2a2f2f41fecc6852cabbb" }, "devDependencies": {}, "ambientDependencies": { "Q": "github:DefinitelyTyped/DefinitelyTyped/q/Q.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "angular-protractor": "github:DefinitelyTyped/DefinitelyTyped/angular-protractor/angular-protractor.d.ts#64b25f63f0ec821040a5d3e049a976865062ed9d", "async": "github:DefinitelyTyped/DefinitelyTyped/async/async.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "browserify": "github:DefinitelyTyped/DefinitelyTyped/browserify/browserify.d.ts#138ad74b9e8e6c08af7633964962835add4c91e2", "browser-sync": "github:DefinitelyTyped/DefinitelyTyped/browser-sync/browser-sync.d.ts#d9b5b35ba3a79ac778c5890531393442439df5dd", "chalk": "github:DefinitelyTyped/DefinitelyTyped/chalk/chalk.d.ts#5a8fc5ee71701431e4fdbb80c506e3c13f85a9ff", "chokidar": "github:DefinitelyTyped/DefinitelyTyped/chokidar/chokidar.d.ts#ae81e340a9e897167cfef3122a5a3aed04293814", "del": "github:DefinitelyTyped/DefinitelyTyped/del/del.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2", "express": "github:DefinitelyTyped/DefinitelyTyped/express/express.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "glob": "github:DefinitelyTyped/DefinitelyTyped/glob/glob.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "gulp": "github:DefinitelyTyped/DefinitelyTyped/gulp/gulp.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "gulp-load-plugins": "github:DefinitelyTyped/DefinitelyTyped/gulp-load-plugins/gulp-load-plugins.d.ts#e081148d88b857d66509e3b46edbd08b3f75f96a", "gulp-shell": "github:DefinitelyTyped/DefinitelyTyped/gulp-shell/gulp-shell.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "gulp-util": "github:DefinitelyTyped/DefinitelyTyped/gulp-util/gulp-util.d.ts#5a8fc5ee71701431e4fdbb80c506e3c13f85a9ff", "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#26c98c8a9530c44f8c801ccc3b2057e2101187ee", "mime": "github:DefinitelyTyped/DefinitelyTyped/mime/mime.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "minimatch": "github:DefinitelyTyped/DefinitelyTyped/minimatch/minimatch.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "micromatch": "github:DefinitelyTyped/DefinitelyTyped/micromatch/micromatch.d.ts#7cda84786520fd0673c934fde1aa722083e05f7b", "ng2": "github:gdi2290/typings-ng2/ng2.d.ts#32998ff5584c0eab0cd9dc7704abb1c5c450701c", "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#138ad74b9e8e6c08af7633964962835add4c91e2", "orchestrator": "github:DefinitelyTyped/DefinitelyTyped/orchestrator/orchestrator.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "parse-glob": "github:DefinitelyTyped/DefinitelyTyped/parse-glob/parse-glob.d.ts#1ae2ddf27c6e9b98ad7e7fa496788f1aadf37933", "run-sequence": "github:DefinitelyTyped/DefinitelyTyped/run-sequence/run-sequence.d.ts#052725d74978d6b8d7c4ff537b5a3b21ee755a49", "selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#a83677ed13add14c2ab06c7325d182d0ba2784ea", "serve-static": "github:DefinitelyTyped/DefinitelyTyped/serve-static/serve-static.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "systemjs": "github:DefinitelyTyped/DefinitelyTyped/systemjs/systemjs.d.ts#5c3e47967affa3c4128a3875d1664ba206ae1b0f", "through2": "github:DefinitelyTyped/DefinitelyTyped/through2/through2.d.ts#5a8fc5ee71701431e4fdbb80c506e3c13f85a9ff", "vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#5a8fc5ee71701431e4fdbb80c506e3c13f85a9ff", "vinyl-source-stream": "github:DefinitelyTyped/DefinitelyTyped/vinyl-source-stream/vinyl-source-stream.d.ts#ffceea9dd124d277c4597c7bd12930666ec074c5", "yargs": "github:DefinitelyTyped/DefinitelyTyped/yargs/yargs.d.ts#6a287502dab374e7d4cbf18ea1ac5dff7f74726a", "zone.js": "github:DefinitelyTyped/DefinitelyTyped/zone.js/zone.js.d.ts#b923a5aaf013ac84c566f27ba6b5843211981c7a" } }
Any something that I'm missing?
@gustavolira try to install node & npm without sudo, using one of these instructions: https://gist.github.com/e-oz/32182190f731ced284ea (it helped me)
I am not sure why this is closed. I have been to this thread, along with other threads from this topic, and I continue to wonder how I will get this working.
I have tried every suggestion I could find on this repository, and currently taking the advice of the last entry, where I am installing node and npm.
I feel that if people feel interested enough to checkout this seed project, that they should not have to go through such an ordeal as I have for the past 2 days.
My frustration is not with the fact that there is not yet a solution to my issue. But it is frustrating that the issue seems to be difficult to reproduce.
I have learned from the past month of trying to get up to speed with Angular 2 that environments, when it comes to node and npm, are wide and varied.
My suggestion is that a smoke test be performed in a clean fresh install of node and npm.
I am using Docker to try this out. I am using the latest image from node as follows
docker run -it --net host node /bin/bash
This brings me to a terminal prompt in the container, and I follow the instructions as explained in the seed github page. That is how you can replicate the issue.
Starting yesterday, I was enthusiastic to try this after watching several videos featuring @mgechev .
The shine has definitely worn off, and I hope others trying to get this to work will not give up after hours trying to troubleshoot this.
There is obviously some very good work done here, and it seems very worthwhile.
Perhaps including a Dockerfile at the root of the project, and using that as a smoke test, will help others to get to a known state so that they can troubleshoot more effectively. It will also help everyone trying to troubleshoot to be able to get to a known state.
Thanks for all of your efforts. I will let you know if the latest adventure works.
+1
I fixed with npm run postinstall
which runs typings install
though I'm not sure why this isn't ran automatically.
Sorry, but the same with me, on Linux
npm ERR! Linux 3.13.0-37-generic
npm ERR! argv "node" "/home/rolando/.npm-packages/bin/npm" "start"
npm ERR! node v0.10.33
npm ERR! npm v2.13.1
npm ERR! code ELIFECYCLE
npm ERR! angular2-seed@0.0.0 start: gulp serve.dev
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the angular2-seed@0.0.0 start script 'gulp serve.dev'.
npm ERR! This is most likely a problem with the angular2-seed package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp serve.dev
npm ERR! You can get their info via:
npm ERR! npm owner ls angular2-seed
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request: npm ERR! /home/rolando/Documents/Projects/angular2-seed/npm-debug.lo
@Rolando-Barbella - Seed requires Node 4+
Wao, sorry for misreading that, is working now! thanks so much!
Node 5.7.1 , npm 3.8.0 , ubuntu 15 installed all npm modules and still getting Unable to compile typescript...
Mine is working with Node 5.8.0, don't know if that helps
Thanks @Rolando-Barbella .
I posted earlier but I deleted the post because I wasn't 100% sure.
Basically, I am getting this error frequently and I have spend a lot of effort trying to fix it or work around it. What it boils down to is if there is an error any typescript file during the _initial _build (e.g. gulp build.dev) the build fails and I cannot continue developing i.e.. I get:
[23:44:52] Requiring external module ts-node/register TSError: ⨯ Unable to compile TypeScript
If the files are error free there is no problem. But, for example, I found one error:
src\app\foo.ts (151,64): Property 'includes' does not exist on type 'string[]'. (2339)
The code in question is fine as far as I am concerned. I am checking if an array of strings includes a string. This is a standard ES2015 array function. It works if I ignore the error. The string is correctly detected.
Arguably, the real problem occurs while watching and developing files. Compilation continues to work even as I introduced small (so-called) errors. However, next time I need to run npm start - nothing works anymore and I have to spend ages fixing the code. Either it should fail both times or it should or treat those errors as warnings both times.
Is there a setting that can be switched on by default in angular2-seed which just does not crash out when I have a minor error in typescript?
Does this make sense?
A surefire way to reproduce this error: if you use the cloud IDE called cloud9, accessible from c9.io, you can follow these steps:
npm install -g typings ts-node typescript
npm install
npm start
. You can see that the angular2-seed project works by navigating to abc-def.c9users.io (where abc is the workspace name, and def is your username)npm start
, npm install
, npm update
, etc... the 'external module ts-node/register' fails 'to compile TypeScript' with a ton of typescript errors, most often giving garbage locations for the line and character numbers. (For example: .c9/metadata/workspace/tools/config/seed.config.ts (1,395))Deleting the node_modules folder and the typings folder does nothing. Manually updating the modules related to typescript does nothing. There seems to be something in the cloud9 workspace that is incompatible with this project - but since others are getting the same error, it may be a helpful tool in figuring out what needs to change to make the project work more seamlessly.
I had the same problem, but solved it by running the postinstall script using sudo:
sudo typings install && gulp check.versions && npm prune
In my case, that fails at gulp check.versions
when gulp tries to load ts-node/register.
I don't have this problem but since ts-node is a devDependency, I would suggest to clean and rerun npm install.
And don't forget that this seed project requires node v4.x.x or higher and npm 2.14.7
Hi, any tsc/typings/typescript/ts-node in global dependencies ? check it with npm -g ls
@aboveyou00 you said
Deleting the node_modules folder and the typings folder does nothing. Manually updating the modules related to typescript does nothing.
did you try npm cache clean
?
or git clean -dfX
? Warning Clean all non staging files + gitignore files ==> so commit all your change before it :)
then npm i
@aboveyou00 - In regards to cloud9, they run in a container. Containers in general have issues with change detection on shared files systems.
I'll try it on cloud9 and see if I can work out what the issue is but given what I have read about their infrastructure, this may vary well turn out to be a problem with the underlying technology (nothing Cloud9 would be able to do about it either).
You can reproduce the same workflow by running your code in a docker container, sharing a local source folder and then changing something.
As an aside, the new docker beta resolves most of the issues with change detection on shared file systems.
@aboveyou00 - And here is the crux of the problem
dist/dev is properly compiled, cloud9 isn't picking up DEV_DEST =
${this.DIST_DIR}/dev;
There are other issues I can see as well but at the core of most of them so far is some variable not being defined.
Given this is running in a "grey box" environment, it's probably going to be more trouble than it's worth to figure out and the end result is we won't be able to do anything about it.
The problem isn't the seed, it's the runtime environment.
@d3viant0ne Thanks for looking into this. I was beating myself over it for several days, it's good to know what the problem is finally, even if I don't yet have a solution. :) I'll just have to change my work environment. If I set up a workspace on ES2 and accessed it using SSH, would I be able to use the cloud9 workspace? Or would the container break even then?
@aboveyou00 - The problem is the container, it's not going to matter how you connect. It would take a ton of back and forth with their support to try and figure out why it's swallowing variables.
I would seriously consider finding another way to pair ( assuming that is what you are doing ). Whatever the issue is, it isn't going to be specific to the seed project so you may very well run into this again with something else.
Here's what you can try, let me know if it works:
In the root of the seed create a file called gulpfile.js
with the following content:
// Set up ts-node to enable loading of TypeScript files.
require('ts-node').register({
noProject: true,
});
// Trampoline into gulpfile.ts.
require('./gulpfile.ts');
Run the build as usually.
Thanks for responding. I tried to do as you suggested, but it doesn't seem to help. Oddly, it no longer says "Requiring ts-node/register", but it still fails with the error "TSError: ⨯ Unable to compile TypeScript".
@aboveyou00 you can try reporting the issue here https://github.com/js-cli/js-interpret because it seems related to this dependency of gulp.
try with following command:
tsc --project tsconfig.json
npm start
still having same problem, Node 6, MacOS 10.11, TS 1.8.6
@aboveyou00 Hey not sure if you've given up with cloud 9 or not, but I have got my build/run working consistently there after applying the small fix from here: https://community.c9.io/t/c9-throws-expected-errors-with-angular2-typescript/4831
basically c9 creates its own .c9/ cache directory at root which screws things up until you ignore that folder in the tsconfig.
@aboveyou00 @d3viant0ne The cloud9 "Serving files from: dist/empty/" thing seems to be a red herring. My output in cloud 9 always says that and yet the project launches correctly. Note the command to start within cloud 9 must change the port to 8080: "npm start -- --port 8080".
@vigie: Thanks so much for posting your response here! You're a godsend! I had given up on this project. Your solution worked perfectly.
For others who may come here, the solution that vigie suggested was to add ".c9" to the "exclude" array in tsconfig.json. (For completeness' sake, to get it working in cloud9 you also have to manually install three packages globally: npm install -g typings typescript ts-node
.)
@aboveyou00 great to have external verification! Just to note in my case I did not ever have to manually globally install anything, npm install was sufficient. I suspect your c9 container could be contaminated after days of tweaking it? Would be interested to know if you find the same on a fresh c9 project.
I have also created a Dockerfile that lets you test this stuff out consistently locally. The only tricky part was needing to make a non root node user for the build. Perhaps I will submit it here if there is interest. It's a great way to verify new releases of the seed as @gotstago suggests and the change detection stuff @d3viant0ne mentions, although very problematic for developing in containers, doesn't matter if you just coppy all the source over to the container for the purposes of testing the runtime.
I am getting this error, with angular alpha 0.40