-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Using the new Angular v4 Option - Could not resolve module opaque_token #4611
Comments
@jwuliger I can confirm this issue, it happens to my when I create a new app using your command, and also in my app I created yesterday. I'm quite sure that app worked fine yesterday and I didn't touch it since (I did mess around with |
@jwuliger in my case I don't get the error when I run Can you try to see if that gets around it? |
@beeman Thanks for a quick response! I use npm link with the cli master so I always have the latest changes you guys make. I have not ventured into trying to modify any of the code though! OK ~ I tried your workaround but I am getting the same error. Maybe I should re-install everything? Thanks so much for your help! |
Ok, that you work with the cli master explains why it fails at both our machines, I tend to run that too. So when you |
OK that makes perfect sense. It did not work for me off the cuff, but I need to try a couple things. Will report back! Thanks! |
OK! You are the man! So what I did was I am still new to package linking be it npm or yarn. Since I did not Thanks so much! |
Great that it works. I think it makes sense to leave the issue open as this should not happen when running it off master.
You should now run it using the locally installed version, so the released version The error is because the module And because Angular CLI still installs dependencies from Angular 2 it has now mixed up the two versions. Another way to get it running (this is quite ugly) is to go to your git clone of Angular CLI and install the Angular 4 dependencies and an upgraded TypeScript there:
I don't recommend this though. The way to go is probably not linking @angular/cli but use the one from npmjs. |
@beeman Thanks so much for your help and explanation. I need to get your number so I can put you on speed dial! haha. Now I get to play with the new NG4 goodness. I also think it is a good idea to leave this open for future reference. Up to you. Thanks again!! |
😂 Glad to hear that it's working and that you can play around with NG4. |
There are several packages that were considered not needed for the CLI, and still seem to fail when using the global install because it doesn't have them (while when you use the local version, the project has them). We saw this in RxJS #4484 and it has to be brought back in #4465, and it's also kinda seen in #4575. Now, if you look closely at #4575, it's missing angular 2.x versions, not 4.x versions. that might be related to the problem. Probably a good solution for this stuff will be to that the CLI ensures the command is run using local package. |
@beeman Tried your method and it did not work for me. Even it works. I do not think this works around is a CI friendly. In CI build step, we have to tell the build step to include some local package over the default "node_modules". I highly suggested to re-open this Issue. And find the core problem and fix it on CLI permanently. |
@mattma the issue is still open and I expect it to be fixed in the next release |
If you are linking your local CLI master, you need to have the same Angular version both in your CLI repo and in the project. If you have Angular 2.4.x in your CLI master but not in your project this will fails, because the CLI will resolve one version, and the compiler another, and it will just mess up during build. The way to fix this is to npm install angular next in your repo. We depend on angular when using the repo because the webpack plugin needs it. This does NOT happen when using the npm package. Closing this as working as intended. |
@hansl Thanks for the explanation Hansl. I did not know that about the CLI and I am glad you explained it. Thanks. |
I have confirmed that it works great after sync up Angular version and Angular-cli version, I can run Here is tricky part. I use But I tried with I did not change any source code. No modify Anyone experience this issue? Is there a way to bypass in |
Try deleting the |
@Meligy I tried One thing to know, in my setup, I has the |
For the record, I just saw this in beta 32, also yarn, no linked packages. I thought using the issue template might be a good idea here.
OS?
Mac OSX latest Versions.
Repro steps.
I'll list what I did literally:
The log given by the failure.
In the console
Mention any other details that might be useful.
|
It works fine with NPM only though. This works:
No errors when project packages are installed using NPM. |
@beeman's suggestion to use |
For those interested in a cleaner workaround to this problem with yarn: ProblemThe problems comes from yarn resolution of the dependencies of dependencies: angular-cli depends on things with versions such as SolutionThe solution should come from yarn IMHO. I'm not sure how though, I will open an issue there (done: yarnpkg/yarn#2763). WorkaroundSimply go change the dependency resolution in yarn.lock, for example, change:
to:
I.e., tells yarn to resolve |
@victornoel Not tried this yet, but I believe it should also be possible to coax it to do the right thing with "resolutions" in package.json? |
@kylecordes ah yes, you are right, it should, but it doesn't work unfortunately… I'm not sure why! They are just ignored! I added the following at the end of my package.json for the record, maybe I didn't do it properly…
|
This is still happening with rc1 and yarn. |
@markgoho it is normal, yarn is the one at fault here, see yarnpkg/yarn#2763 and complains to them :) |
With |
@mattma I noticed the same yes :) |
@victornoel this issue should be very safe to close. |
Yes, it seems to work well now for me also. |
Great! good to know |
I delete the files of type yarm.lock in the project and I work without problems. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS?
Windows 10
Versions.
@angular/cli: local (v1.0.0-beta.31, branch: master)
node: 7.5.0
os: win32 x64
@angular/common: 4.0.0-beta.7
@angular/compiler: 4.0.0-beta.7
@angular/core: 4.0.0-beta.7
@angular/forms: 4.0.0-beta.7
@angular/http: 4.0.0-beta.7
@angular/platform-browser: 4.0.0-beta.7
@angular/platform-browser-dynamic: 4.0.0-beta.7
@angular/router: 4.0.0-beta.7
@angular/cli: 1.0.0-beta.31
@angular/compiler-cli: 4.0.0-beta.7
Repro steps.
The error happens when you try to run a freshly created ng4 project
Step 1:
ng new my-project -ng4 --skip-install true --skip-git true --skip-tests true --skip-commit true --style scss --prefix ri --routing
Step 2
cd my-project > ng serve/build.
You will see this error:
ERROR in Could not resolve module @angular/core/src/di/opaque_token
The log given by the failure.
No logs, but I think this may have to do with AOT. Not sure.
Mention any other details that might be useful.
When Beta.31 first was released, I was able to follow the exact same steps as above and everything worked.
Just a snap of my console:
The text was updated successfully, but these errors were encountered: