Error when running Ionic serve in Ionic 2


#1

I ran in node.js version 4:

Your environment has been set up for using Node.js 4.4.3 (ia32) and npm.

C:\Users\vvs>d:

D:\>cd stockMarketApp-master

D:\stockMarketApp-master>ionic serve
There is an error in your gulpfile:
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (D:\stockMarketApp-master\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:22:11)
    at Object.<anonymous> (D:\stockMarketApp-master\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:188:23)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (D:\stockMarketApp-master\node_modules\gulp-sass\index.js:3:17)
    at Module._compile (module.js:409:26)

D:\stockMarketApp-master>

Actually i was trying to doing a git clone from this https://github.com/hunterleaman/stockMarketApp
However, there is error for clone succeeded, but checkout fail" because file name was too long.
Thus, I download the zip file of the source code and unzip it.
However, the above error occurred. I even install the node-sass but still same error occurred.
Please help.


#2

@bkcollection Could you provide more details, e.g. the output of ionic info? If you’re using Windows I would recommend you to run the Node.js command prompt as Administrator. Check out the linked post for details:


#3

Not sure if this is the problem, but I would suggest upgraded node to 5.11.1. it seems to work really well with the build system. I know node 6.x will give a similarr erro.


#4
C:\Users\vvs\Documents\GitHub> git clone https://github.com/hunterleaman/stockMarketApp.git
Cloning into 'stockMarketApp'...
remote: Counting objects: 10662, done.
remote: Total 10662 (delta 0), reused 0 (delta 0), pack-reused 10662
Receiving objects: 100% (10662/10662), 12.93 MiB | 33.00 KiB/s, done.
Resolving deltas: 100% (1970/1970), done.
Checking connectivity... done.
fatal: cannot create directory at 'node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/got/node_modules/duplexify/node_modules/end-of-stream/node_modules/once/node_modules': Filename too long
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

this is the full error when i ran in git shell


#5

BTW, I have no issue for running ionic code with the current steup, not sure if it is due to ionic 2?


#6

@bkcollection I think that installing the latest version of NPM should resolve the problem because it uses a flat directory structure, check out the linked topic for details:


#7

I have the same error after i upgrade node.js to 5.11.1
I saw the same problem in git shell…
Could you try it up and see the same issue?Thanks
It is a quite an urgent project for me


#8

for the zip file method, I have download gulpfile too, but the same error still exits
:cold_sweat:


#9

On windows for node-sass you need to have Visual Studio installed. its a horribly non descript error. But installing VS will fix it.


#10

Notice that Node.js and NPM are different things. Check the NPM version using npm -v. The flat directory structure (which should solve this issue) was introduced in NPM v3, so you’ll need NPM 3.x.x.


#11

My npm version already 3.8.6
it did no fix the issue


#12

Visual studio isn,t it a ide like subline text or atom?
How it will fix the problem?


#13

https://www.briantist.com/errors/failed-to-clone-the-repository-github-for-windows/

Follow this link help to fix my error
However, even it able to clone the same issue node sass still exist

There is an error in your gulpfile:
Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (D:\GitHub\stockMarketApp\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:22:11)
    at Object.<anonymous> (D:\GitHub\stockMarketApp\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:188:23)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (D:\GitHub\stockMarketApp\node_modules\gulp-sass\index.js:3:17)
    at Module._compile (module.js:413:34)
D:\GitHub\stockMarketApp [master ≡]>

#14


npm install --msvs_version=2013 gulp node-sass gulp-sass
using the above command and return this error for running ionic serve

D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]>  ionic serve
Uh oh! Looks like you're missing a module in your gulpfile:
Cannot find module 'vinyl'

Do you need to run `npm install`?

I already run out of idea. Below are the versions that in my win10 computer

D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]>  npm -v
3.9.0
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]>  node -v
v5.11.1
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]>  gulp -v
[17:09:03] CLI version 3.9.1
[17:09:03] Local version 3.9.0
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]>  node-sass -v
node-sass       3.7.0   (Wrapper)       [JavaScript]
libsass         3.3.6   (Sass Compiler) [C/C++]
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]>  cordova -v
6.1.1
D:\GitHub\stockMarketApp [master ≡ +245 ~0 -5054 !]>  ionic -v
2.0.0-beta.25

#15

Did you try to run npm install in the project directory?
Just npm install.


#16

yes
This the error shown when i did npm install

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12
npm WARN yourappsname@1.0.1 No repository field.
npm WARN yourappsname@1.0.1 No license field.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\chingcs\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v5.11.1
npm ERR! npm  v3.9.0
npm ERR! path D:\GitHub\stockMarketApp\node_modules\gulp\node_modules\v8flags\node_modules\.bin\user-home
npm ERR! code EEXIST

npm ERR! Refusing to delete D:\GitHub\stockMarketApp\node_modules\gulp\node_modules\v8flags\node_modules\.bin\user-home: is outside D:\GitHub\stockMarketApp\node_modules\gulp\node_modules\v8flags\node_modules\user-home and not a link
npm ERR! File exists: D:\GitHub\stockMarketApp\node_modules\gulp\node_modules\v8flags\node_modules\.bin\user-home
npm ERR! Move it away, and try again.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\GitHub\stockMarketApp\npm-debug.log
D:\GitHub\stockMarketApp [master ≡ +246 ~0 -5059 !]>  ionic serve
Uh oh! Looks like you're missing a module in your gulpfile:
Cannot find module 'vinyl'

Do you need to run `npm install`?

#17

This doesn’t look like a flat directory structure, I would suggest you to delete the node_modules folder underneath your project’s folder, before trying to run npm install.

Not sure for Win 10, but on a previous Windows releases this is needed (i.e. maybe for Win 10 too):

If nothing else helps you’ll probably have to try this (in order to enable node module rebuilds):


#18

Is it the right way by delete the node modules? It can run with ionic serve without installing back.
I afraid some problems occur in the future.


#19

Of course you have to install them again as it has been already written above.

I would suggest you to complete the following steps in this particular order:

  1. Delete the node_modules folder underneath your project’s folder.
  2. Find Node.js command prompt, right click on it and select Run as Administrator.
  3. Navigate inside your project’s folder and run npm install from there.
  4. Observe if there are any NPM errors during the reinstall, i.e. lines starting with npm ERR!.
  5. After the node modules are reinstalled try running ionic serve.
  6. If it doesn’t work then check this SO answer or perform the node-gyp install for Win 10.
  7. If you had to perform the step above then also reinstall node-sass.

If you get any errors while performing the steps above, could you share them here, and the output of ionic info might be also helpful.


#20

Thanks a lot. It works!!
There are warning along the installation, but I think it is safe.

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12
npm WARN yourappsname@1.0.1 No repository field.
npm WARN yourappsname@1.0.1 No license field.