AngularJS tutorial: NPM install gives error "cannot find module" - javascript

I'm having a problem where I follow the AngularJS tutorial exactly and it gives me errors. Part of the problem is that the tutorial itself is a little ambiguous with what commands you should be running and where. It seems to assume that as a newbie, you're a complete expert already.
THE INSTRUCTION
"Install Node.js
If you want to run the preconfigured local web-server and the test tools then you will also need Node.js v0.10.27+ (yeah totally, that thing... I know exactly what you're talking about and whether I'll need it or not).
You can download a Node.js installer for your operating system from http://nodejs.org/download/.
Check the version of Node.js that you have installed by running the following command:
node --version (got this to work through trial and error. Apparently you have to run this through Git. Node.exe is just a mirage that seems like a program that runs commands and stuff).
Once you have Node.js installed on your machine you can download the tool dependencies by running:
npm install"
Notice how it doesn't tell me whether I'm running this command in Node or windows command prompt or Git. It assumes I'm an expert and totally know what to do through osmosis.
So I run the command in Git...
THE ERROR
~/Desktop/angular-phonecat (master)
$ npm install
module.js:339
throw err;
^
Error: Cannot find module 'C:\c\Chris' Documents\Cash Receipts\previous\node.js\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:134:18)
at node.js:961:3
Any idea what to do? Never had so much trouble installing a program in my life. 7 hours and counting.

Related

I keep getting an error in Vite version 3.2.4 which says `[vite:esbuild] The service is no longer running: write EPIPE`

After creating a vite app. I run the command npm run dev and I get this error
[vite:esbuild] The service is no longer running: write EPIPE
Please, How do I solve this error.
I have tried the following solutions
Vite build fails with esbuild error
error while transforming /app/client/vite.config.ts with esbuild in Docker image
Turn off your Antivirus Software
Disable your antivirus software then go ahead and run:
npm run dev
I found a solution to my problem. If you have an anti-virus, you need to uninstall it.
I myself, I had to uninstall SMADAV anti-virus.

Cypress failed to start. This may be due to a missing library or dependency (M1 mac)

I just got my M1 and trying to get my head around cypress so basically following basic steps in order to open cypress and check if its there and its possible to run it.
mkdir cypress_test
npm init -i
npm install --save-dev cypress
npx cypress open (thats where issues appears)
Cypress failed to start.
This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies
Please refer to the error below for more details.
Command failed with Unknown system error -86: /Users/test/Library/Caches/Cypress/9.6.1/Cypress.app/Contents/MacOS/Cypress --no-sandbox --smoke-test --ping=610
spawn Unknown system error -86
I have attempted trying to install cypress with force with the following command -
npx cypress install --force however sadly it did not help and same error appears
I also saw somebody manage to fix it by changing Mac with M1 chip to OS ver. 11.5.x (BigSur) however is not something i would like to do.
Any help is appreciated
Thanks.
The only way that i managed to sort this out is by install Rosetta 2 that transitions between Intel and Apple processors.
softwareupdate --install-rosetta --agree-to-license
https://www.cypress.io/blog/2021/01/20/running-cypress-on-the-apple-m1-silicon-arm-architecture-using-rosetta-2/
The Problem
At the moment, Cypress cannot be compiled under the ARM-based architecture of new Mac computers and Continuous Integration (CI) providers do not currently offer M1 instances. For these reasons, Cypress is not currently released for the ARM-based architectures and will require Intel emulation for some time.
Therefore, running npm install cypress will install the Intel-based package until these challenges are resolved. See here for workaround
See here for more info https://www.cypress.io/blog/2021/01/20/running-cypress-on-the-apple-m1-silicon-arm-architecture-using-rosetta-2/

Unable to create React.js project in WebStorm

I am going to create a React.js web application in WebStorm. I have installed create-react-app in /usr/local/bin and Node.js interpreter. I use Debian sid Linux distribution. When I try create project in WebStorm I receive this error:
/usr/bin/node /usr/local/bin/index.js .
module.js:538
throw err;
^
Error: Cannot find module '/usr/local/bin/index.js'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
Done
I hope for help.
Try installing both node and create-reat-app globally by using -g flag in npm and make sure both are available system wide. To make node-interpreter available globally try setting default in nvm or try installing nodejs-legacy.
Anyways Web storm provides coding assistance depending on the file extension. Such as if it is a .jsx file then auto completion helps you in writing react specific syntax and enhanced ES syntax.
Also even after creating the project via Webstorm you have to install dependencies though npm install.
So my suggestion is instead of getting stuck just create a project using only create-react-app from the console by typing create-react-app
and then everything will be set for you. Test the set up by going inside the project folder and running npm start you could see basic react app open in your browser.
For further coding you can open your project folder inside web storm and continue with your project

Error: Cannot find module 'entities/lib/decode_codepoint.js'

I am using cheerio module for web scraping . It require htmlparser2 module , after installing htmlparser2. it gives following error-
Error: Cannot find module 'entities/lib/decode_codepoint.js'
Use this in your terminal:
npm install grunt-contrib-jshint --save-dev
Seen here:
https://www.npmjs.com/package/grunt-contrib-jshint
Below is applicable to Windows environment only, not Linux.
I received the same error when I tried to build jquery from source on Windows. It turns out that jsdom and/or grunt-contrib-jshint (both of which depend on htmlparser2) require gyp and for gyp to work you need a c++ compiler and python. I thought that I had them but turned out, that python need to be version 2.x not version 3.x. If it is 3.x it gives you a proper error on the first run (that I missed) and on subsequent runs you are getting the error in the question above which makes you wonder what's going on.
So I uninstalled python 3.x, installed python 2.x (don't forget make sure that python.exe is in your path), then deleted the node_modules folder in the project root and ran the build again.
This time around it worked. I'm not sure if this solves the OP question, but I hope it helps someone.

Can't properly install Meteor 0.6.1

I recently wanted to update to Meteor 0.6.1 from 0.5.4 and just did a meteor update in terminal. Immediately got an error in my terminal that gets thrown basically when I try anything.
/Volumes/Macintosh HD/Users/martijn/.meteor/meteor: line 35: cd: /Volumes/Macintosh: No such file or directory
module.js:340
throw err;
^
Error: Cannot find module '/Volumes/Macintosh HD/Users/martijn/tools/meteor.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
I removed all of Meteor for a complete reinstall:
rm /usr/local/bin/meteor
rm -rf /usr/local/meteor
curl https://install.meteor.com | /bin/sh
Same error when I try to create a Meteor project in my Sites directory. Can't figure out whats causing this, it used to work great in my Sites directory. The only way to avoid this error is to paste all the docs, examples, packages, scripts and tools folders into my /Volumes/Macintosh HD/Users/martijn/ directory along with my projects which is very messy.
Was thinking that it might have to do something with that I'm running two harddrives in my Macbook, an SSD for the OS and HDD for my documents. /usr/local/bin where meteor gets installed is on my SSD. This seems to me like something is off with the paths of the installation, any ideas?
Thanks
This seems to have been a bug in how we escape directory names. You hit this because your home directory has a space in it ("Macintosh HD"). I believe I fixed this just now, and the fix should be released in 0.6.2: https://github.com/meteor/meteor/commit/c059c384fdf9e7169f25cc36d86fbc0ed0a9da83
I had this same issue. Luckily I had another computer with Meteor where the upgrade worked. So here is what I did:
I noticed that usr/local/bin had very different files in the working and not working computer. So I just copied all the files from the working computer into the non-working one. Now meteor works on both. Not sure it's the best approach, but solved my issue. Meteor commands work once more.
Hope this helps,
Paul

Categories

Resources