Node Js run build errors can't resolve component - node.js

When i do a npm run build I am getting the following error.
./pages/_app.js
Module not found: Can't resolve '../components/Nav/Nav' in '/home/webuser/node_site/document/pages'
The components and Nav folder are in the correct location. Also the Nav.js file is also there. I have also tried ../components/Nav/Nav.js still giving module not found.
Node is version 12.16.2
npm version 6.14.4

Ok well this is embarrassing. I had caps incorrectly mac doesn't seem to however linux does. the folder structure is components/nav/Nav the code is ../components/Nav/Nav it compiled just fine on the mac. Once I changed the code to ../components/nav/Nav everything worked.

Related

NodeJS Windows 10 geolocation module throws error in electron when the app starts

I was using module "#nodert-win10-rs4/windows.devices.geolocation" in an electronjs app which was working fine. Later I installed a node module and rebuilt all the modules. Now it stopped working and throwing error. The previous version of that module ( "#nodert-win10-rs4/windows.devices.geolocation") was 1.0.0, Thus I reinstalled it, new version of the module is "0.3.2" but still error. Even i tried this in fresh new electron quick start app and I see the same error. I'm adding here the screenshot of the package.json and the error. (FYI - The module is installed and rebuilt without any error although it has some warning, I've added a screenshot of the installation/built too). Really appreciate any help/suggestions.
I saw other posts with similar errors but I already took the actions mentioned there.
Thanks
Musa
N.B - Cross posted here
I ran into the same issue and here is how I resolved it.
Copy the windows.devices.geolocation into your electron app folder and update the dependencies to point to the location of the folder. You need to this line added to your package.json of your Electron App
"windows.devices.geolocation": "file:windows.devices.geolocation"
Navigate to the newly copied folder and build your NodeRT "addon" to match your Electron version. See this post here NodeRT with Electron
node-gyp rebuild --target=4.0.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell
Run npm install at the the top level Electron app.

node 6.11.3 NODE_EXE not found in IntelliJ

I've updated my project to use node 6.11.3. When I now try to start a npm-script by using the Run-configurations provided from IntelliJ, I always receive the following error:
Error: Failed to replace env in config: ${NODE_EXE}
Important: This error appears only if I start npm from within my project. If I use the windows cmd, the error doesn't appear.
What could possibly have changed between node 6.11.2 and 6.11.3? Because with the prior version, everything worked fine.
A workaround for me is to add the NODE_EXE variable to my run configuration, but In my opinion, that shouldn't be needed, because it worked in 6.11.2 too.
Looks as if you have ${NODE_EXE} variable set in one of your npmrc files (see https://docs.npmjs.com/files/npmrc#files), and it can't be properly expanded for some reason when you run your script in the IDE.
is the issue specific to certain project?
how many npm versions do you have installed? Please check that npm chosen in Node.js Interpreters dialog is the same as you use in cmd shell?
please create an env.js file with console.log(process.env) and try running it via npm ("env" : "node env.js") in both cmd console and WebStorm - what is the result?

(Visual Studio Code & NodeJS) - Could not install typings files for JavaScript language features?

I had installed latest NVM and used it to install NodeJS (macOS). Everything was okay, NodeJS ran normally. But when I started VS Code the following message appeared:
Could not install typings files for JavaScript language features. Please ensure that NPM is installed or configure 'typescript.npm' in your user settings
So I tried to find more official information from VS Code team. They said to insert the path to the npm executable file in the typescript.npm setting.
I used $ which npm to find the npm directory :
/Users/myusername/.nvm/versions/node/v8.3.0/bin/npm
but there is no executable file there. I also tried to insert this address into VSCode typescript.npm setting but it did not work.
My question is, where can I find the npm executable file address on macOS to insert into this typescript.npm setting so the error wouldn't pop up anymore ?
Thank you!
Releated VSCode issue: link Maybe it will help you.

Error: Module version mismatch. Expected 47, got 48

I'm writing a Visual Studio Code extension which uses a native node.js module. When I try to debug this extension in vscode I get the error message from above, when loading the native module (when commenting out the require() call no error comes up). It tried quite a few steps to overcome + test this:
npm uninstall native-module followed by a npm install native-module --save-dev in my vscode extension folder, this compiled the native module completely and without problems.
Completely cleaned my node_modules folder in the extension and did again the npm install --save-dev.
Installed node.js again, both LTS and current. With LTS the error message changes to: expected 47, got 46.
Installed latest vscode (August recovery build)
Launched a node session in my vscode extension folder and loaded my native module. This works nicely.
Read the various questions and comments here on SO. They mostly recommend what I described above.
Still, I cannot get vscode to accept my native module. What can I do? From the above steps it appears as if vscode has been built with a node.js version between current and LTS. Can I force my native module somehow to use a specific version?
Btw. what do those numbers 48, 47, 46 etc. actually mean? The node.js version is of course in the typical form: major.minor.build and nothing of that matches the above version numbers.
Update:
ok, I found what those numbers mean: https://nodejs.org/en/download/releases/
Once you know what those numbers in the error message mean it's easy to solve the issue. Simply install the node.js version that is expected. In my case it's node.js 5.12.0.
Remove node_modules folder
Run npm update
Then;
Run npm install

Cannot find module 'assetmanager'

I'm trying to run the MEAN stack on windows. I've installed all the pre-requisites (I think) but when I try to start the server via the gulp command I get the error:
Error: Cannot find module 'assetmanager'.
IMAGE:
I have tried running npm install assetmanager which run fine but I still get this error.
This is my first time trying to run node on a machine (I should have used a linux box) so go easy on me as I am learning :-).
Any and all help appreciated.
David
I had exactly the same problem on Linux Mint 17.2.
The failing way: This was my first project that I'd generated and I don't think I had all the dependencies installed before I ran the init command (g++ was missing).
I tried the npm install assetmanager command as you did and then install worked. Running gulp after this, it got further but this time I was missing mongoose. I installed that then it couldn't find .../config/env/all so I sylinked the default.js config. Then running gulp again, errorhandler was missing. I figured it shouldn't be this hard so...
The working way: I deleted that failure of a project and init'd a new one and it worked. Unfortunately I'm not sure if the init didn't work the first time but I missed the error/warning or something else caused it. All I can recommend is try creating another project and see if that works.

Resources