VS 2015 Angular 2 import modules cannot be resolved - javascript

I have created an empty web project and added files using
Angular-cli
https://scotch.io/tutorials/use-the-angular-cli-for-faster-angular-2-projects
I can run the website fine using ng buid/serve but I get below error in editor:
I read somewhere that it is Resharper error in version 9, so I upgraded my Resharper to latest which fixes the problem but it cannot resolve the modules. any suggestions?
Edit: created a new typescript class and it's giving below error

As far as I know, Resharper still doesn't support TypeScript latest versions. It looks like Resharper ignores tsconfig.json file that exists inside src folder. I suggest you try VS Code instead. It's free and has much better support of new TypeScript features.
If you still want to stay with VS 2015, you can configure Resharper not to analyze .ts files. Here is how to do it.

open npm and run npm install typings and then typings install and if after that it still doesn't work, try build the project

Try installing VS2015 update 3.
I had that error before and I was due to my typescript version installed in VS2015.

Related

Why is typescript compiler changing my tsconfig.json file on server start up?

I'm trying to move my react app to a react-typescript app. firstly, this seems really tricky which is disappointing
the issue I'm having is that I get typescript errors in my console. I'm trying to fix them by changing my tsconfig.json file
but whenever I do and restart the server, I get a message in the console saying: the following changes are being made to your tsconfig.json file
and then it lists the changes which are basically "undos" of the stuff I've just added or changed. why would it do this?
it is a create-react-app project and I followed this to migrate to typescript: https://facebook.github.io/create-react-app/docs/adding-typescript
You can manually add a tsconfig.path.json file with all the compilerOptions included and add "extends": "./tsconfig.path.json" to your tsconfig file.
I had the same issue as the tsconfig file was being overwritten as soon as I run react-scripts.
I had older react-scripts version
"react-scripts": "^2.1.3"
I changed it to latest version
"react-scripts": "^5.0.0"
And now it doesn't modify the tsconfig.
The error eventually went away after upgrading to the latest version of Typescript
I have been getting this issue for my React 17 project. Every time I run npm start, it overrides whatever I configure in {jsx: ...} with react-jsx in order to be compatible with JSX transform in React 17. And it shows the following message:
The following changes are being made to your tsconfig.json file:
compilerOptions.jsx must be react-jsx (to support the new JSX
transform in React 17) The problem is VSCode using an older version of
typescript (4.0.3), while the typescript version shipped with the
project is (4.1.2).
SOLUTION:
The following did the trick for me:
In visual studio:
Go to the command palette and press CTRL+Shift+P.
Choose "TypeScript: Select a TypeScript Version...".
Choose "Use workspace Version".
if you are using Create React App, you can add the following in your .env file. Then restart the server. it should work.
DISABLE_NEW_JSX_TRANSFORM=true
Ejecting from create-react-app worked for me.
Command: npm run eject

Visual Studio 2017 Intellisense with Aurelia

I have been trying desperately for a month to figure out a way to get JavaScript intellisense to work for Aurelia in Visual Studio 2017. I know there is no definitions in npm #types. I tried to copy over the index.d.ts file from the local node_modules folders to a folder in the Salsa Cache at c:\Users\User\AppData\Local\Microsoft\Typescript\2.5\#types that is named the same as the Aurelia module, along with the package.json. It didn't work. I tried adding a jsconfig.json. Also didn't work. Is there anyone with Aurelia intellisense working in VS 2017????????
I'm not sure if this is applicable to your installation, but there is a known issue (https://github.com/jspm/jspm-cli/issues/1344) with type definitions when Aurelia is installed via jspm. The solution for now, unfortunately, is to also install Aurelia as a dev dependency via npm.
npm install --save-dev aurelia-framework aurelia-bootstrapper aurelia-pal-browser aurelia-polyfills
This takes up more space, but should resolve the issue until it's fixed properly.

Use eslint on cloud 9 ide

I have installed eslint correctly, like the following on my cloud 9 (c9) environment:
npm install -g eslint
eslint --init
I would like to actively use eslint with c9 on the one hand to get errors fixed, but on the other hand to point out inconsistencies within my js. However, I haven`t found any configuration page or way to add it directly to the ide.
Any suggestions how to add my configuration to c9 and run the eslint command automatically?
Appreciate your replies!
Cloud9 has eslint built in by default, however the default implementation of eslint uses a browser copy of eslint that does not support the same features as the cli tool, This plugin supports eslint properly.
https://github.com/michaelmitchell/c9.ide.language.javascript.eslintd

How to get intellisense for AngularJS in VSCode?

So can anyone help me get the AngularJS intellisense working in Visual Studio Code?
Is it possible to configure this globally or can it only per project? I'm preferably looking for a solution on how to do this globally, as in whenever I open VSCode AngularJS intellisense just works.
I'm currently using AngularJS 1.5.x. I do not know if it possible to configure according to the version of AngularJS being used. Additionally, I'm using VSCode 1.10.2 and VSCode - Insiders on Windows 10.
I've already searched in several places, but the solutions I've found did not work for me. Maybe it's because they are old.
There are many extensions available for intellisense in Angular (2+), but not for AngularJS. However, this article by Mike Barlow explains how to do it and it's fairly recent since you've asked your question (June 2016).
Here's the summary of what you need to do per the article:
Have the following tools installed: node.js 6.2+, npm 3.9+, and VSCode 1.2+.
Install the typings package globally: npm install -g typings. Make sure this is a 1.X version.
Install AngularJS types: typings install dt~angular --save --global
This should create a a folder typings\globals\angular\ with a file called "typings.json"
Create a file within this directory as a sibling to "typings.json" called "jsconfig.json". This file can remain empty unless you need to transpile code (ie, using typescript, coffeescript, etc.)
Restart VSCode

Uncaught Error: Module did not self-register

I try to use node-vlc with nw.js (v0.12.0-alpha2). When i launch my app without nw.js it works, but when i launch it with nw.js i got an error:
Uncaught Error: Module did not self-register.", source: /home/alexis/Bureau/dev/jukebox/node_modules/vlc/node_modules/ffi/node_modules/bindings/bindings.js (84)
I tried some commands with nw-gyp but it couldn't help me.
I am on Ubuntu 14, 64-bit.
If you've upgraded node then npm rebuild might fix this for you
For me:
rm -r node_modules then
npm install
I had a similar issue with another product and my fix was to change the version of node I was using. I was using 0.12.0 and changed back to 0.10.26.
Personally, I use NVM to handle node version changing. With NVM installed it's as simple as running
nvm use 0.10.26
Or setting the default version to 0.10.26
nvm alias default 0.10.26
Hopefully this helps you out - our issues came from different products but the solution may be the same.
I had similar problem.
/Users/user/NodeAddons/bridge/node_modules/bindings/bindings.js:83
Error: Module did not self-register.
In my case I was doing a C/C++ Add-on, and I had forgotten to export the add-on, in my main.cc was missing the code below:
void Init(v8::Handle<v8::Object> exports) {
NODE_SET_METHOD(exports, "method", method);
}
NODE_MODULE(method, Init);
Hope this helps others!
Thanks :)
I've add the same issue because I installed to modules as sudo...
Removing the node modules folder and reinstalling as normal user fixed it.
For me npm rebuild or npm update didn't work. I had to remove the node_modules folder and run npm install to install them again.
I once had this problem when creating a multi-file c++ addon. In my binding.gyp file I had:
"sources": ["src/*.cc", "src/*.h" ]
And my project contained several *.cc files. However, the NODE_MODULE() macro was called only on one file which imported the rest of the files. But node expects that it is called on the frist *.cc file listed in sources. So I had to change sources to explicitly add that file to the beginning
For me, running npm update worked
I was getting an internal error: Module did not self-register.
Deleted the node_modules folder
ran npm install
It worked just fine.
I had this error with Snappy. Was using Node 11. Checked Snappy's NPM page https://www.npmjs.com/package/snappy where they listed which versions of node they supported.
Deleting node_modules folder rm -rf node_modules and then reinstalling using the correct version of Node resolved it.
One of the versions they supported on Linux at the time of this writing was Node version 12.
nvm deactivate 11
nvm uninstall 11
nvm install 12
nvm use 12
Problem solved
Another cause of this problem: if you're using pm2, then after upgrading node you may need to reinstall pm2. Test whether pm2 is the issue by running your app
without pm2 node server.js
then with pm2: pm2 start server.js.
Proper way to update PM2 after updating Node.js
I had this same issue with 0.12 and io.js 1.3.0, reverting to Node.js 0.10 fixed the issue.
Rebuild your C++ add-ons.
Did you encounter something like this?
Module did not self-register: '…\node_modules\#u4\opencv4nodejs\build\Release\opencv4nodejs.node
It’s likely that you have just updated your Node.js. Once you updated your Node.js, you need to rebuild your C++ add-ons, Node.js packages written in C++.
Why
When you build Node.js’ C++ add-ons, they get compiled into require-able .node files and linked to the currently installed Node.js ABI library, which is not compatible with other versions of it. Your packages were built only compatible with the specific version of Node.js.
How
Firstly, try npm rebuild. If your C++-add-on-based packages have a build script, it’ll do. If it doesn’t, you need to manually build your C++ native add-on packages. Do again what you did when you were installing such packages. Refer to the building instructions in the packages’ documentations to rebuild them. Or try reinstalling (npm install) them.
I had the same problem. My script that was referencing a global reference script had an invalid reference. I took off that invalid reference and the error was gone. My error message had no indication of that particular invalid reference which made it harder to debug. But 'Uncaught Error: Module did not self-register' was the message I was getting.
This also happen in my other project. For some reason, it wouldn't recognize the reference path if one of the characters are uppercase. Even thought, the upper-casing was the correct spelling of the path.
I had this issue while setting up my Cypress project.
I found out the issue was caused because Cypress uses node from its bundle version by default (which was version 8.0 in my case) , whilst the package I wanted to use required the node version to be 10 or higher.
I did have node 12.0 installed on my machine but since cypress was not using that I had to add the line shown below in the settings file (cypress.json) to set the value for 'nodeVersion' to 'system', to tell cypress explicitly to use the node version installed on my machine.
Add this line to your settings file:
**"nodeVersion": "system"**

Categories