I am trying to create a new stenciljs project using the provided command npm init stencil
After running the above command, i get this error
Can someone please help me to find out what exactly is going wrong.
One observation is that after running the command, a new folder named Rohan is created under users directory. Here is my users's directory:
I was able to figure put the solution. Thanks to Thomas for giving me a hint in the comment :)
The issue was related to the npm-cache path. Since i have space in the username, the cache path was not taken properly. I fixed the path by running this command(set the path for the respective folder only):
npm config set cache "C:\Users\Rohan~1\AppData\Roaming"
After this, the command npm init stencil will ran properly and was able to create the project.
Related
I am quite new to programming and today decided to attempt and create a node.js and puppeteer project with the purpose of scraping website into a .txt file. I ran into issues straight away since for the most part I have no idea what I'm doing. After installing node.js and puppeteer, I was guided by some videos and articles I found to create my first project. In the command prompt using mkdir and later cd I was able to create and access the new directory, but I started running into problems with npm init. It only places the file package.json in the repository, but there isn't a package-lock or node_modules file anywhere. No idea what they do but thought this was a problem. When I open cmd and try to run the app by typing node app.js it returns Error: Cannot find module 'C:\Users\emili\app.js' along with some other gobble. What should I do, to be able to run the simple application I wrote?
It seems that you are missing some key knowledge on how NodeJS works, but in order to fix your issue (for now), you will need to take a few steps.
First, in your working directory (where the package.json is), you'll need to install your modules.
Run npm install puppeteer. This will do two things, create the node_modules folder and create the package-lock.json file.
Create a file named app.js (either manually or by running the command touch app.js) in your working directory, and put the following content inside of it:
console.log('Hello, World!');
Save the changes to app.js and then run node app.js in your terminal. You should see Hello, World! output to the terminal.
The reason npm install puppeteer created the node_modules folder and the package-lock.json file is because they weren't needed beforehand.
When you run npm install PACKAGE_NAME, you're installing a module (otherwise known as a package), thus it creates the node_modules folder so that it will have a place to put the module so that your code can access it. It also creates the package-lock.json file, which is used to track the module versions inside of your project.
With this information, I request you go back to the tutorial you were originally following and try going through it again and attempting to understand each of the core concepts before writing any real code.
I just installed ionic with npm and when I run -v to check the version it gives me an error and that says "ionic is not recognized as an internal or external command". Basically it's like I never installed the package in the first place. After a while I figured that my default folder for npm has changed.
I'm using Windows 10 so I think it should be something like
User\MyUser\AppData\npm\node_modules" or maybe "User\MyUser\AppData\Roaming\npm\node_modules" but for whatever reason npm installs stuff inside "AppData\Local
I asked around a bit (even here on stackoverflow) and found out that if I edit the environmental variable "PATH" things should work, so I did it and ionic now works fine
However today I tried to install express and the same error popped up. I checked my PATH again just to be sure and it's pointing to the "Local" folder where my node_modules are. Ionic still works right now and it's in the same folder, so I have no idea why express doesn't work.
I want to fix things once and for all, how do I change the place where the node_modules are? How do I go back to AppData or Roaming or whatever folder Windows 10 uses by default?
I'm building a .Net Core application using Angular for my client-side code. For the most part, I'm using the default template that is included in VS 2017. For whatever reason, VS is making my node_modules folder read only. Before I was able to install packages via command line in the directory that holds my client side code as well as my package.json file and my node_modules folder. Before I was able to do this, but now it is defaulting the folder to read only which is invaliding all of my npm commands. I've verified that this is the case because I can remove the read only attribute via windows explorer and then run any of my commands like npm install.
Has anyone else encountered this before? If so, what did you do to resolve this?
Thanks!
Okay, I found the answer. VS puts a lock on the node_modules folder while it is running.
So, I guess for now if you need to add packages just close VS first.
Usually when I do 'npm install' inside my application directory, bunch of npm libraries files gets generated inside node_modules folder which is expected.
Today suddenly I started seeing many files getting generated inside application directory and outside node_modules.
Did anyone face this issue ? and if yes - any workaround ? Screenshot attached. Lot's of .cmd file, don't know why they are here.
Edit your c:\Users{username}.npmrc and remove the prefix.
I had the same issue, and was able to resolve this by completely uninstalling + re-installing Node/npm:
How to completely remove node.js from Windows
I am having two issues in compiling Sass using Gulp currently. Firstly, I set 777 permissions in my "/Library/Ruby/Gems" directory to free up some permissions errors I was getting. I'm now receiving a warning each time I run Gulp, stating the following:
gulp-ruby-sass: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:213: warning: Insecure world writable dir /Library/Ruby/Gems/2.0.0 in PATH, mode 040777
Second, things seem to halt in terms of Sass compilation when Gulp runs into some of the "#import" declarations in my primary SCSS file. Namely, I get the following errors:
gulp-ruby-sass: error ./screen.scss (Line 4: File to import not found or unreadable: normalize.
Load paths:
/private/var/folders/cq/_pg4s6qn59q1q5fyy5681rd00000gn/T/gulp-ruby-sass/bower_components/compass-breakpoint/stylesheets
/private/var/folders/cq/_pg4s6qn59q1q5fyy5681rd00000gn/T/gulp-ruby-sass/bower_components/susy/sass
/private/var/folders/cq/_pg4s6qn59q1q5fyy5681rd00000gn/T/gulp-ruby-sass/bower_components/normalize-scss
/private/var/folders/cq/_pg4s6qn59q1q5fyy5681rd00000gn/T/gulp-ruby-sass)
These load paths look incorrect...I've installed these components via Bower for this project specifically, so it almost seems like I need to tell Gulp/NPM to look in my project folder instead.
Any help would be greatly appreciated!
Looks like this question was just me doing a whole lot of talking to myself, but I'll share my findings with the world nonetheless.
Turns out, this is a known issue with the gulp-ruby-sass package. See:
https://github.com/sindresorhus/gulp-ruby-sass/pull/80#issuecomment-49531932
Paths specified in the "loadPath" option in my gulpfile were not relative to the gulpfile's location in the project I was working with, so it wound up looking for some Bower components in a folder where it shouldn't have, for example:
/private/var/folders/cq/_pg4s6qn59q1q5fyy5681rd00000gn/T/gulp-ruby-sass/bower_components/compass-breakpoint/stylesheets
I found that, by prepending process.cwd() to each of my file paths, they would become relative.
If you take a look at the GitHub link I added a few lines above, you'll notice this is simply a temporary workaround until this fix is implemented into the master branch of gulp-ruby-sass, so this advice will become irrelevant at some point in the near future.
Hope this helps anybody that was in a similar, puzzled situation.
* EDIT *
As for the permissions warning I was getting for gulp-ruby-sass, it turned out I just needed to run sudo chmod -R 775 /Library/Ruby/Gems/2.0.0 to recursively change the permissions in the Gems directory.